Open Source Tutorials - Open Source Training
Open source training & tutorials from experienced, passionate people
chrome icon firefox icon ie icon opera icon safari icon Sings in these Browsers
A- A A+

By A Web Design

pdf icons

WordPress Posts - Pagination

For Pagination to work, first you have to download, install and activate the plugin, in WordPress.

NOTE: Please click here to refer to tutorial for Downloading the WordPress Pagination Plugin Description and Download.

NOTE: Please click here to refer to tutorial for Installing and Activating the WordPress Pagination Plugin Install.

After activating and installing the WordPress Pagination plugin, you have to make changes in your template file for pagination to be displayed on your website.

For posts pagination you have to open the current theme files where you'd like pagination to be used. Usually this is the loop.php file.

NOTE: For older version of WordPress, you may need to update the index.php, archive.php and search.php files.

In the left menu, locate the link Appearance. Click on Appearance, the drop down menu as shown in Diagram 1.

diagram1.png
Diagram 1

From the drop down menu that appears click on Editor as shown in Diagram 2.

diagram2.png
Diagram 2

The editor window opens for the specific theme styling as shown in Diagram 3.

Scroll down the vertical scroll bar in order to locate the file(s) displayed on the right hand side of page.

diagram3.png
Diagram 3

Click on loop.php file as shown in Diagram 4.

diagram4.png
Diagram 4

Locate the following codespec Code 1 in the editor window as shown in Diagram 5.

Code 1:

code1

NOTE: If you are using the default theme “Twenty Ten” of WordPress 3.0.x, you will find the above codespec in loop.php file.

NOTE: The codespec may vary for different themes. So locate the previous_posts_link() and next_posts_link() block of codespec in your current theme.

NOTE: If you do not find the above Code 1 codespec in your template then directly paste the Code 2 codespec as shown in Diagram 6.

diagram5.png
Diagram 5

Replace the above codespec with the following block of codespec as shown in Diagram 6.

Code 2:

code2

After pasting the codespec, click on Update File, in order to make the changes saved as shown in Diagram 6.

diagram6.png
Diagram 6

The successful message of “File edited successfully” is displayed as shown in Diagram 7.

diagram7.png
Diagram 7

Set Posts per Blog Page:

Ensure that the WordPress core knows the number of posts permissible on blog page in order to make pagination work perfectly.

The following are the simple steps to set the number of posts visible on a blog page.

In the left menu, locate Settings. Click on Settings, from the drop down menu that appears click on Reading as shown in Diagram 8.

diagram8.png
Diagram 8

The Reading Settings page opens as shown in Diagram 9.

diagram9.png
Diagram 9

Change the number of posts that you want to be display for Blog pages as shown in Diagram 10.

diagram10.png
Diagram 10

The successful message of “Settings saved” is displayed as shown in Diagram 11.

diagram11.png
Diagram 11

On the frontend of your website, you will be able to see the pagination for Posts as shown in Diagram 12.

diagram12.png
Diagram 12

For the purpose of this tutorial the number of Blog posts chosen was 1. This was to demonstrate multiple pagination links on the Home page. Usually the number of Blog Posts is set to 5 or 10, instead of 1. Please feel free to choose whatever number of Blog posts you want seen on the Blog page.

OSV Newsletter


Receive HTML?

NOTE: To prevent subscription to the OSV newsletter, uncheck the checkbox above.
Guest Blog for OSV
Free Ebook Download
LinkShare_180x150
Artisteer - DNN Skin Generator
Tapestry Theme - A Tumblog-Style Theme for Wordpress