Quantcast
Viewing all articles
Browse latest Browse all 2

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'); ?>
<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.

Image may be NSFW.
Clik here to view.
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

Incoming search terms:

Follow us on Twitter WordPress API


Viewing all articles
Browse latest Browse all 2

Trending Articles