Skip Navigation

[Resolved] Amount of Items per Page on different devices

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

Problem:

Display different results depends on user's device.

Solution:

Here is a workaround, you can use WordPress wp_is_mobile() function to display different view's shortcode, for example:

https://toolset.com/forums/topic/amount-of-items-per-page-on-different-devices/#post-1759967

Relevant Documentation:

This support ticket is created 3 years, 8 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: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by davidJ-4 3 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#1759597

Tell us what you are trying to do?

I have a View set up as carousel slider which shows 4 entries per page on desktop and tablets but I want only to show 1 entry per page on mobile devices.

I thought View would give the ability to change the amount of Items per page throught the devices icons that already exists for a few Toolset attributes but I was wrong.

How can I make the carousel slider show only 1 entry on mobile devices?

Thanks

#1759967

Hello,

There isn't such kind of built-in feature within Toolset.

Here is a workaround, you can use WordPress wp_is_mobile() function to display different view's shortcode, for example:
1) register it at Toolset > Settings > Front-end content, in section "Functions inside conditional evaluations", add the function name: wp_is_mobile

2) You could then use it like so:

[wpv-conditional if="( wp_is_mobile() eq '1' )"]
Mobile content here
[/wpv-conditional]
 
[wpv-conditional if="( wp_is_mobile() eq '0' )"]
Other content here
[/wpv-conditional]

More help:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
https://developer.wordpress.org/reference/functions/wp_is_mobile/

#1765741

Sorry for the delay in my response. So does this mean I have to create another view in gutenberg for the mobile version?

#1765765

Yes, it needs to create different view for different device, in your case, you can create another view in gutenberg for the mobile version

#1766083

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.