add ajax pagination in wordpress blog

For without refresh the data from home page if you want to show the pages and pagination in wordpress blog than yyou can use the following code.

With the help of jquery you can easily add the pagination wordpress blog site. You just need to add the following code into header.php file.

<?php wp_enqueue_script('jquery'); ?>
 // ajax pagination
 jQuery('#wp_pagination a').live('click', function(){ // if not using wp_pagination, change this to correct ID
 var link = jQuery(this).attr('href');
 // #main is the ID of the outer div wrapping your posts
 // #entries is the ID of the inner div wrapping your posts
 jQuery('#main-container').load(link+' #entries')
}); // end ready function

just put above code in header.php file in head section. Just make sure that you are putting above code after wp_head function.

add ajax pagination in wordpress blog add ajax pagination in wordpress blog

If you are not wordpress developer then dont use following code and If you are facing any issue then write to me on

You may like following Articles!

  • John

    Ajax pagination in wordpress blog is the requirment for websites. Thanks webmaster

  • Swathi

    Hi ,
    I have s:file upload tag in my jsp.and one sx:autocompleter tag.
    if i change the element in sx:autocompleter the ajax to work.
    But the s:file tag is preventing not to work ajax properly.
    Can you give me some idea.Pls…..
    Im trying this for past one week…..
    Thanks in advance.