Load more posts on button click
-
Hi,
I want to load more posts on button click but it only load 2 posts and no more. Please help.
<?php
if (isset($_POST[‘button’])) :
$ids=array();
query_posts(array(‘posts_per_page=2’),array(‘posts__not_in=$ids’));//query_posts(array(‘post__not_in’ => $ids));
while ( have_posts() ): the_post();/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.*/$ids[] = get_the_ID();
get_template_part( ‘content’);
// End the loop.
endwhile;
wp_reset_query();
endif; ?><?php endif; ?>
- The topic ‘Load more posts on button click’ is closed to new replies.