user3444371
user3444371

Reputation: 5

Wordpress category filter with pagination

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!

Upvotes: 0

Views: 2264

Answers (1)

sergiovilar
sergiovilar

Reputation: 372

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;

?>

Upvotes: 1

Related Questions