[Support request] Different home page for mobile device

Home Forums Support [Support request] Different home page for mobile device

Home Forums Support Different home page for mobile device

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1152175
    manaadiar

    Hi Tom, sorry the below code that you suggested (and worked) for other site is not working for me..I am using GP Premium with a child theme..

    Can you pls advise..??

    add_action( ‘wp’, ‘tu_redirect_mobile’ );
    function tu_redirect_mobile() {
    if ( wp_is_mobile() AND is_front_page() ) {
    wp_redirect( ‘https://beta.zeine.es/contacto-movil’, 301 );
    exit;
    }
    }

    #1152241
    Leo
    Staff
    Customer Support
    #1152260
    manaadiar

    Hi Leo, no, it didn’t work.. I thought if I use the mobile option in the customize screen and change there, it will work.. But I see it changed the whole home page and i realised that the mobile sign there only “shows” how it will look..

    What i want is, currently my home page is https://shippingandfreightresource.com.. I want the home page to show https://shippingandfreightresource.com/mob-home when users are viewing on mobile device..

    #1153005
    manaadiar

    Hi Leo, no, it didn’t work.. I thought if I use the mobile option in the customize screen and change there, it will work.. But I see it changed the whole home page and i realised that the mobile sign there only “shows” how it will look..

    What i want is, currently my home page is https://shippingandfreightresource.com.. I want the home page to show https://shippingandfreightresource.com/mob-home when users are viewing on mobile device..

    #1153018
    David
    Staff
    Customer Support

    Hi there,

    you will need to use the PHP snippet that Tom provides here to create a redirect for mobiles:

    https://generatepress.com/forums/topic/different-homepage-for-mobile/#post-554306

    #1153024
    manaadiar

    Hi David, i did use it but doesn’t seem to work on my site..

    #1153032
    David
    Staff
    Customer Support

    How are you adding the code ?

    #1153034
    manaadiar

    its there in functions.php file

    #1153069
    David
    Staff
    Customer Support

    Try adding it using the Code Snippets plugin – if it still doesn’t work then some other function must be conflicting with it.

    #1153303
    manaadiar

    I dont have the code snippets plugin.. Can you suggest any other code..??

    #1153307
    Leo
    Staff
    Customer Support

    Can you disable all other custom functions to test for now?

    And make sure to clear and disable the caching plugin during testing.

    That code should be correct. It’s a WordPress function and not controlled by the theme:
    https://developer.wordpress.org/reference/functions/wp_redirect/

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.