Support » Plugins and Hacks » Load previous/next posts without whole page reload

Load previous/next posts without whole page reload

  • I have limited the amount of posts displayed from a certain category. This can be seen in the code below (ive cut out a bit of code to shorten it for this post). Anyway so what i would like to happen is when the next and previous links are clicked to display older/newer post ids i would like it to load these without having to reload the whole site.

    Im new to wordpress and this is a learning curve, i realise this may require some use of ajax or jQuery. All im after is point in the right direction.

    $page_num = $paged;
    if ($pagenum='') $pagenum =1;
    query_posts('cat=5&showposts=7&paged='.$page_num); ?>
                   	<?php if (have_posts()) : ?>
    		<?php while (have_posts()) : the_post(); ?>   
    <!-- item -->
    <div class="menutest"><h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1></div>
    <!-- end item -->
    <?php endwhile ; ?>
    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div><p> </p></div>
    <?php endif; ?>

    Thank you very much in advance!

Viewing 1 replies (of 1 total)
  • Something like this should get you started:

    jQuery('.navigation a').click(function() {
         jQuery('.menutest').load(jQuery(this).attr('href') + " .menutest");
Viewing 1 replies (of 1 total)
  • The topic ‘Load previous/next posts without whole page reload’ is closed to new replies.