0

I have a list of child pages which are getting displayed as links to those pages. Im displaying it in a certain div with a maximum of 6 results. What I want is I have a "a href" which is called more... so when clicked I want to fetch and display the next 6 results (so the first 6 are replaced by the next). A button that does it is fine also, how would I do this? What I have so far in a have_posts loop is:

$subs = new WP_Query( array( 'posts_per_page'=>6, 'post_parent' => $pid, 'post_type' => 'page',  'orderby' => 'menu_order title' ));

 if( $subs->have_posts() ) : while( $subs->have_posts() ) : $subs->the_post();
 if ($link==get_permalink()) echo '<li><h1><a href="'. get_permalink() .'">'. get_the_title() .'</a></h1></li>';
else echo '<li><h2><a href="'. get_permalink() .'">'. get_the_title() .'</a></h2></li>';

endwhile; endif; wp_reset_postdata();
0

Why don't you just use the build in features to page your results

Just simply add the paged parameter to your query arguments, and don't forget to set the $max_pages parameter in next_posts_link()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.