Skip Navigation

[Resolved] different archive for mobile

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

Problem:

Display complete different Views wordpress archive for mobile user.

Solution:

Use filter hook "wpv_filter_force_wordpress_archive" to trigger a custom PHP function, check if it is a mobile user, then return different wordpress archive ID.

Relevant Documentation:

https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_force_wordpress_archive

This support ticket is created 6 years, 3 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 2 replies, has 2 voices.

Last updated by Ido Angel 6 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#1074224

Hey,

Is there any way to create a different archive view for mobile users?

The only solution I could think of now is inline the loop, to duplicate the html and insert one copy inside a div with a class hidden in css for desktops, and the other copy inside a div with a class hidden in css for mobiles - but that would just be too heavy and would actually load each archive twice.

Any ideas?

thanks!
ido

#1074746

Dear ido,

If you are going to display different grid size for mobile user, you can consider the bootstrap framework, see bootstrap document:
hidden link
See how aspects of the Bootstrap grid system work across multiple devices with a handy table.

IF you are going to display complete different Views wordpress archive for mobile user, then you will need to consider custom codes, for example:
1) use filter hook "wpv_filter_force_wordpress_archive" to trigger a custom PHP function
2) In this PHP function, check if it is a mobile user
https://stackoverflow.com/questions/39167148/mobile-detect-function-is-not-working-in-my-site
then return different wordpress archive ID

#1074753

Thanks Dear Luo!
Yes - I need completely different archive. But I think the solution you suggested might work.
Cheers,
Ido