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

I have a index,php with various new WP_Query all working ok, but in this block I need to implement that "AJAX thing people love - the load more posts":

   <h2>Latests articles <?php bp_site_name(); ?></h2>

   $destaque = get_term_by('slug', 'destaque', 'post_tag');
   $video = get_term_by('slug', 'video', 'post_tag');

   $nd_query = new WP_Query (array('tag__not_in' => array($destaque->term_id, $video->term_id), 'posts_per_page' => 5, 'paged' =>$paged));
   while ($nd_query->have_posts()) : $nd_query->the_post(); ?>

   <span class="box-excerpt" id="post-<?php the_ID(); ?>">
   <h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h3>

   <?php endwhile; ?>

Tought this was simple but I can't even figure out how to set a pagination in this block. If there's anything than AJAX let me know.

NOte! I'm modifying an BuddyPress theme, that came with some AJAX, maybe is there smeway to re-use things.

share|improve this question
I found a excelent tipo from Scribu now the pagination works: scribu.net/wordpress/wp-pagenavi/wpn-2-74.html I think I'm halfway on the AJAX thing. – Diana Jun 22 '12 at 17:26
Do I have to do this wordpress.stackexchange.com/questions/20424/… in order to implement AJAX?! Tough wp_paginavi works that I would assume that AJAX would too :(. – Diana Jun 23 '12 at 19:26
up vote 1 down vote accepted

The tutorial that Michael Martin posted on Pro Blog Design should help you: http://www.problogdesign.com/wordpress/load-next-wordpress-posts-with-ajax/

share|improve this answer
Thanks Pippin, but my issue is: I don't have any pagination, this is just a block using new WP_Query most examples deal with the main query. – Diana Jun 22 '12 at 1:48

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.