Add lighter homepages for mobile view
-
Hi.
I’d like to be able to load a lighter version of my homepages for all languages.
For this I tried to use this code:
function mobile_redirect() { if ( ! wp_is_mobile() && ! is_front_page() ) { return; } $locale = substr( get_locale(), 0, 2 ); $base_url = get_home_url(); switch ($locale) { case 'en': $homepage = '/homepage-en-mobile/'; break; case 'ru': $homepage = '/ru/homepage-ru-mobile/'; break; default: $homepage = '/fr/homepage-fr-mobile/'; } //header( 'Location: ' . $base_url.$homepage ); //exit; wp_safe_redirect( $base_url.$homepage ); exit; } add_action( 'init', 'mobile_redirect', 0 );
But I have an infinite redirection loop due to the Polylang redirection :(…
Is there’s a way to “bypass” it, only for the homepage, please?A big thanks in advance (hopping it will be doable).
Pierre.
- The topic ‘Add lighter homepages for mobile view’ is closed to new replies.