I’d like to display first 5 posts from category with name ‘press’, with ‘load more’ button.

I can only show a specific number of posts per page. I want to make an Ajax call to load rest.
I never used Ajax on WP before, any help would be appreciated!

<?php
$category_id = get_cat_ID('press');
$catquery = new WP_Query( 'cat=' .$category_id. '&posts_per_page=5' );
while($catquery->have_posts()) : $catquery->the_post();
?>

 <h4><?php the_title(); ?></h4>
 <time><?php echo get_the_date('F j, Y'); ?></time>

<?php endwhile; ?>

Thanks

Read more here: Display specific WordPress category on custom page with ajax


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: