Skip Navigation

[Resolved] Displaying more than 50 posts in a View

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to display more than 50 results in an unpaginated View.

Solution: Use this custom code to increase the number of posts per page:

add_filter( 'wpv_filter_query', 'set_arbitrary_limit', 99, 3 );
function set_arbitrary_limit( $query_args, $view_settings, $view_id ) {
  $views = array( 12345 );
  if ( in_array( $view_id, $views ) ) {
    $query_args['posts_per_page'] = 67890;
  }
  return $query_args;
}

Replace 12345 with the numeric ID of your View. Replace 67890 with the maximum number of posts you want to display.

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

This support ticket is created 6 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by Charles 6 years ago.

Assisted by: Christian Cox.

Author
Posts
#1131496

Support,

How can I increase the number of posts displayed for my View above 50?

I tried to implement this code, but I'm not using pagination: https://toolset.com/forums/topic/make-more-than-50-posts-show-on-paginated-view/

Thanks,
Charles

#1131516

Hi, here's an updated snippet:

add_filter( 'wpv_filter_query', 'set_arbitrary_limit', 99, 3 );
function set_arbitrary_limit( $query_args, $view_settings, $view_id ) {
  $views = array( 12345 );
  if ( in_array( $view_id, $views ) ) {
    $query_args['posts_per_page'] = 67890;
  }
  return $query_args;
}

Replace 12345 with the numeric ID of your View. Replace 67890 with the maximum number of posts you want to display.

#1131998

My issue is resolved now. Thank you!