WordPress article pagination Method Summary

Source: Internet
Author: User
Tags php file

When editing an article, switch to HTML input, and then enter the page where you want it

The code is as follows Copy Code
<!--nextpage-->

Some topics just add <!--nextpage--> tag is not enough, but also need a theme to support paging function, if you add a page tag, but the theme is not paging, then your theme does not support paging, you need to add yourself.

Add method: Open the article template (generally the subject of the single.php) file, if not single.php file, you need to find the article template.

Find the following function

The code is as follows Copy Code

<?php the_content ();?>

Then add the code behind it

The code is as follows Copy Code

<?php
Wp_link_pages (' Before ' => ' <div class= ' page-link ' > '. __ (' page number '), ' after ' => ' </div> ');
?>

Although paging is implemented but not very convenient, the code for paging labels needs to be entered manually each time

Process: 1, find Wp-includes/js/quicktags.js, find the following JavaScript code:

The code is as follows Copy Code
Edbuttons[edbuttons.length]=new Edbutton ("Ed_more", "more", "<!–more–>", "", "T",-1);

After this code, add the following code:

The code is as follows Copy Code
Edbuttons[edbuttons.length]=new Edbutton ("Ed_next", "page", "<!–nextpage–>", "", "P",-1);

2. Continue to find the following code in the Wp-includes/js/quicktags.js:

The code is as follows Copy Code
J.buttons[j.buttons.length]=new Edbutton (A + "_more", "more", "<!–more–>", "", "T",-1);

Add the following code:

The code is as follows Copy Code
J.buttons[j.buttons.length]=new Edbutton (A + "_next", "page", "<!–nextpage–>", "", "P",-1);

OK, this file can be saved.

3. Find Wp-includes/js/quicktags.dev.js, find the following code

The code is as follows Copy Code
/*
Edbuttons[edbuttons.length] =
New Edbutton (' Ed_next '
, ' page '
, ' <!–nextpage–> '
,”
, ' P '
,-1
);
*/

Get rid of the note, and finally the following

The code is as follows Copy Code
Edbuttons[edbuttons.length] =
New Edbutton (' Ed_next '
, ' page '
, ' <!–nextpage–> '
,”
, ' P '
,-1
);

4. Find wp-admin/includes/post.php and find the following code:

The code is as follows Copy Code
' Link ', ' unlink ', ' Wp_more ',

To add code after it:

The code is as follows Copy Code
' Wp_page ',

OK, when you open the editor to write the article, the visual state will appear in the page Break button, you want to insert the page number when you click this button on the line

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.