Passer la navigation

[Résolu] how to increase display items per page on pagination? more than 50 items

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

Problem:
The customer wants to display more than 50 items on a single page. They are not following any documentation and do not have an example to reference.
Solution:
We informed the customer that currently, it is only possible to change the maximum items from 50 to a higher number using custom code. We provided the following code snippet to be added to their child theme's/theme's function.php file:

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

It is needed to replace 12345 with the numeric ID of the View and 100 with the maximum number of posts you want to display.

This support ticket is created Il y a 2 years, 1 month. 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 -

Fuseau horaire du supporter : America/Sao_Paulo (GMT-03:00)

Marqué : 

Ce sujet contient 1 reply, a 2 voix.

Dernière mise à jour par Mateus Getulio Il y a 2 years, 1 month.

Assisté par: Mateus Getulio.

Auteur
Publications
#2697353

Tell us what you are trying to do? I want to display more items on a single page, more than 50

Is there any documentation that you are following? No

Is there a similar example that we can see? No

What is the link to your site?

#2697447

Mateus Getulio
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Sao_Paulo (GMT-03:00)

Hello there,

I'm afraid that as of now, only by using some custom code it is possible to change the maximum items from 50 to a higher number.

Please add the following code to your child theme's/theme's function.php file:

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

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

Please give it a try and let us know.
Mateus