Wordpress 2.8 Implementation Content Pagination tutorial

Source: Internet
Author: User
Tags modify php file prev wordpress update
WordPress Update to 2.8, everything else is good, just add a new article when the page button is gone. In the WordPress Chinese Forum found a solution, so write down for later use

Open the/wp-includes/js/quicktags.js file and look for the following code:

Edbuttons[edbuttons.length]=new Edbutton ("Ed_more", "more", "<!--more-->", "", "T",-1);

After this code is added:

Edbuttons[edbuttons.length] =new Edbutton (' ed_next ', ' page ', ' <!--nextpage--> ', ', ', ' P ',-1);

Find code:

J.buttons[j.buttons.length]=new Edbutton (A + "_more", "more", "<!--more-->", "", "T",-1);

After this code is added:

J.buttons[j.buttons.length]=new Edbutton (A + "_next", "page", "<!--nextpage-->", "", "P",-1);

Save and upload the file after it has been modified.

Then modify the/wp-admin/includes/post.php file to find the code:

' Wp_more ',

To add after:

' Wp_page ',

After the completion, save, upload, finished ~ If the change is still not visible, then you need to do one more step!


Find yourself using the template "\wp-content\themes\ folder you use", find "single.php", open find:
<?php the_content ();?>
Then add the following code after the statement:
<?php link_pages (' <p><strong> pagination:</strong> ', ' </p> ', ' number ');?>
One of the "pagination" You can change the word you want to use.


If you want to implement paging functionality on your home page, you need to "\wp-content\themes\ the template folder you use", find "index.php", find the statement:
The_content
With my example: after I find it, find "<?php the_content (' Read more ... ', ' Elegantbox ')",?>, and then add the statement after the statement:
<?php link_pages (' <p><strong> pagination:</strong> ', ' </p> ', ' number ');?>
Save, upload, and overwrite the modified file.


Add 1:
The above display is the simplest, if you want to add a "previous page" "Next" option, you need to change a little bit, the steps are as follows:
In the code we just added "<?php link_pages (' <p><strong> pagination:</strong> ', ' </p> ', ' number ');?>" Back or front (the small path is added to the front) add the following code:
<?php wp_link_pages (Array ("Before" => "<strong>", "after" => "</strong>", "Next_or_number" => " Next "," Previouspagelink "=> __ (" prev ")," Nextpagelink "=> __ (" next page "));?>
If you want to change to a small blog in this way, the text changes color, font size becomes larger and centered, you can change the above statement to this:
<p align= "center" ><strong><font size= "5" ><?php wp_link_pages (Array ("Before" => "<strong") > "," after "=>" </strong> "," Next_or_number "=>" Next "," Previouspagelink "=> __ (" prev ")," Nextpagelink "=> __ (" next page "));?></font></strong></p>
The specific effect can be seen in this article's display.
Add 2:
If you want to achieve a display similar to the previous Page 1 2 3 next page, you can make the following modifications:
<p><?php wp_link_pages (' before=&after=&next_or_number=next&previouspagelink= page & Nextpagelink= ');?>
<?php wp_link_pages (' Before=&after=&next_or_number=number ');?> <?php wp_link_pages (' before=& after=&next_or_number=next&previouspagelink= &nextpagelink= next page ');?></p>
The above several ways to modify, can achieve a single article paging function, just show different ways, we can choose their favorite.
However, in the feed output will appear the problem of incomplete article, so, need to modify a little bit.



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.