Home Forums Weaver Xtreme Theme REdirect Mobile view to Different Home Page

Topic Resolution: Answered

This topic contains 7 replies, has 3 voices, and was last updated by  wanda 4 weeks ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #61851
    Answered

    wanda
    Participant

    Is it possible to serve a different page when viewed on a mobile or tablet?

     

    Just up graded to Weaver Extreme and can’t see anywhere to do it

     

    thanks Wanda

    #61854

    scrambler
    Moderator

    No that is no longer the case as it is normally not needed with Xtreme, given it has all sort of responsive features allowing the layout to adapt as well as device visibility options.

    It also has show if / hide if shortcodes that can be  used to limit content to some devices.

    The best is for you to describe what issue you are trying to solve, or what customization, and we can guide you through the features or custom solutions

     

    #61859

    Weaver
    Keymaster

    There may be plugins that can do that. Try searching plugins for redirect for mobile or something like that.

    #61866

    wanda
    Participant

    I can only find a plugin that does a 301 redirect which I would like to avoid for SEO purposes.

     

    I also found the code belwo and wonder if that could be used.  If so where? Should I use a child theme?

    <?php
    //* Do NOT include the opening php tag shown above. Copy the code shown below.
    //* Redirect homepage on mobile
    add_action( wp_head, wps_params, 10 );
    function wps_params() {
    ?>
    <script>
    if (window.location.pathname == / && jQuery(window).width() <= 480) {
    window.location = /webshop/;
    }
    </script>
    <?php
    }

    This function adds a small script to the head section of the theme. The script checks if you’re on the homepage and if the width of your browser is 480px or smaller. In case both are true the web shop page is loaded, instead of the default homepage (see the code example above).

     

    Thanks Wanda

    #61867

    scrambler
    Moderator

    If you have a script that would do that, you could insert just the script (without the PHP), directly in the head section, by dropping the script in Advanced options > Head Section. This would be the code

    <script> ……. </script>

    FYI, Phone is normally a browser under 580px wide

    That said, If you would explain what difference you want between the regular home page and the mobile home page, we could may be give you a solution,

    For example, if it is about displaying different content on the page, you could do that with the Show_if shortcode

    #61871
    Best Answer

    wanda
    Participant

    This reply has been accepted as the best answer.

    This did the trick

    https://guide.weavertheme.com/show-if-hideif-selectively-display-content/

     

    I used this code in the content area of the page

     

    [show_if device=mobile]

    Show this on a mobile but not on a computer

    [/show_if]

    [hide_if device=mobile]

    Hide this on a mobile but not on a computer

    [/hide_if]

     

    #61873

    scrambler
    Moderator

    Which is what I suggested from the beginning 🙂

    #61874

    wanda
    Participant

    Yes, thanks you did Scrambler.

     

    Just needed to get my head around it .  Also now I have a reminder and the exact code. Which may help someone else too!

     

    thanks again for your (as usual) excellent help

     

    cheers

     

    Wanda

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.