Skip Navigation

[Resolved] responsive control of Limit (and Offset) in View block settings

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

Problem:
The user would like to use different view's items count per screen. For example, display 9 posts in Desktop and only 3 posts in mobile.

Solution:
Currently, there is no option or setting to change the number of posts per view depending on the screen/device. You can only do it using two views. Put each one inside a container block, and make them show or hide depending the screen.

There is also a hook you can use to programmatically change the settings of a view. The wpv_view_settings hook. Check the example code on it.

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

This support ticket is created 3 years, 9 months 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
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 2 replies, has 2 voices.

Last updated by Anthony 3 years, 9 months ago.

Assisted by: Jamal.

Author
Posts
#1993369

I have a View currently displaying WooCommerce products on the home page of hidden link . The Limit is currently set to 12. The Grid Column settings for screen, tablet, and smartphone are 6, 4, and 2 respectively, resulting in 2, 3, and 6 rows being displayed. Two and three rows for screen and tablet are fine, but I really don't want six rows for smartphone - ideally it would be just two. So the feature I'd really like is to have responsive selections for Limit (and Offset, I guess), but for right now, is there a kluge way to accomplish this other than two views selected by a conditional?

#1993525

Hello and thank you for contacting the Toolset support.

Currently, there is no option or setting to change the number of posts per view depending on the screen/device. You can only do it using two views. Put each one inside a container block, and make them show or hide depending the screen.

There is also a hook you can use to programmatically change the settings of a view. The wpv_view_settings hook. Check the example code on it.
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_view_settings

#1995173

My issue is resolved now. Thank you!