WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We can use multiple plugins like wp-pagenavi or wp-paginate for implementing pagination for wordpress sites and making it ajax based using the following code:

    // ajax pagination
    jQuery('#wp_page_numbers a').live('click', function(){ 

        var link = jQuery(this).attr('href');                   
        jQuery('#main').load(link+' #entries')
}); // end ready function

Sometimes, there are some cases where we want to display results based on custom query (i.e fetching results from the tables other than wordpress default tables) on a page template.

What is the best way for implementing pagination in this case?

share|improve this question

Soumitra Chakraborty wrote a very good tutorial on Getting Started with AJAX & WordPress Pagination. I would recommend following that pattern (in terms of how to use admin_ajax.php in conjunction with your functions.php.

That tutorial will give you a great framework for how to implement ajax pagination by hand.

In terms of your own specific requirements for a custom query (which it sounds like might involve getting data from non-standard tables) you can use the WP_Query class to do some pretty advanced stuff (like what you describe) in your custom function that you define in functions.php.

share|improve this answer
Thanks for providing this article Jared. I'll try to implement ajax using these steps now. – swtshweta Oct 2 '12 at 3:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.