March 29, 2014

Pagination with special recent post Plugin


Today, I'm going to show you how to add pagination with Special recent post Plugin.
If you are using special recent post plugin to show recent posts in your blog website.
You might have stuck with pagination problem i.e. what If you have 100 post and you want to show 10 posts per page?

I've made some custom changes in the special recent post plugin to made it work with pagination.
Follow these instructions to add pagination.
First we need to set the plugin is fetching the posts from the database so we need to set the offset option into the queries option so we can say what page number is requested and fetching from number of post up to 10 or whatever post you need to show in one page.
Go to the "special recent posts"  plugin now go to class directory of it. You'll find a file

class-main.php

Open it.

Now find the function

getPosts()

This is where it the code of posts fetching is written.
Now take backup of file and replace following function with the original function.

Now go to the your current theme write it open the template file of your blog page.
Replace this code after the end of the while loop.

Now check the your blog page. The pagination should be working.
Apply style as per your theme.

That's it. Easy isn't it?
Subscribe to my blog and stay updated with more tips and tricks.

Kindle Apps