0
votes

is there any solution for filtering by post categories with pagination. At present, it only filter the posts are in the current page, but not anymore. You can see here: The Method Case

Thanks!

1

1 Answers

1
votes

You can use WP_Query for this purpose. For example:

<?php

$posts = WP_Query(array(
  'category_name' => 'my-category',
  'paged' => 2 // Page 2
));

while($posts->have_posts()): $posts->the_post();
  // do some stuff
endwhile;

?>