Advertise on Site! You can Advertise on our site. Find out More

add ajax pagination in wordpress blog

3 Flares Twitter 3 Facebook 0 Google+ 0 StumbleUpon 0 LinkedIn 0 Buffer 0 Filament.io 3 Flares ×

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'); ?>
<script>
jQuery(document).ready(function(){
 // 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
 jQuery('#main-container').html('<div><h2>Loading...</h2></div>');
 // #entries is the ID of the inner div wrapping your posts
 jQuery('#main-container').load(link+' #entries')
 });
}); // end ready function
</script>

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 support@wordpressapi.com

3 Flares Twitter 3 Facebook 0 Google+ 0 StumbleUpon 0 LinkedIn 0 Buffer 0 Filament.io 3 Flares ×
  • http://digcms.com John

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

  • http://javashome.blogspot.com 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.

3 Flares Twitter 3 Facebook 0 Google+ 0 StumbleUpon 0 LinkedIn 0 Buffer 0 Filament.io 3 Flares ×