Skip Navigation

[Résolu] Displaying more than 50 posts in a View

Ce fil est résolu. Voici une description du problème et la solution proposée.

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 Il y a 5 années et 6 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 réponses, has 2 voix.

Last updated by Charles Il y a 5 années et 6 mois.

Assisted by: Christian Cox.

Auteur
Publications
#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!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.