Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #206194

    I posted about this a little earlier and Josue sent me this link to check out.

    http://stackoverflow.com/questions/16165211/how-to-set-a-different-static-homepage-for-mobile-version-wordpress

    I’m trying the 3rd post. When i put the code at the top of my headers.php file it didn’t perform a redirect and the code showed up on my site. So i added a line above it, right at the top of my headers.php file, “<?php” and now the site just shows up as a blank white page.

    Any suggestions as to what I might be doing wrong? This is how the top of my headers.php file looks now :

    <?php
    if( is_front_page() ){

    include_once(‘mobile-detect/Mobile_Detect.php’);
    $detect = new Mobile_Detect();

    if ( $detect->isMobile() || $detect->isTablet() ) {
    $redirect_url = ‘http://jonnyfreesh.com/music&#8217;;
    header(‘Location: ‘ . $redirect_url ); // Redirect the user
    }
    }
    <?php
    global $avia_config;

    $style = $avia_config[‘box_class’];
    $responsive = avia_get_option(‘responsive_layout’,’responsive’);
    $blank = isset($avia_config[‘template’]) ? $avia_config[‘template’] : “”;
    $headerS = !$blank ? avia_header_setting() : “”;
    $headerMenu = $responsive ? avia_get_option(‘header_menu’,’mobile_drop_down’) : “”;

    ?>

    Thanks

    Jonny

    #206209

    doh! Very new to custom coding. Didn’t work though, still same problem. Any other suggestions?

    #206215

    Hey!

    Please remove the code then install this plugin: http://wordpress.org/plugins/wp-mobile-detect/

    Edit header.php, find this code on line 2:

    global $avia_config;

    On top of it, add this code:

    if( wpmd_is_phone() ){
            $redirect_url = 'http://jonnyfreesh.com/music';
            header('Location: ' . $redirect_url ); // Redirect the user
    }

    Remove browser cache then reload the page.

    Regards,
    Ismael

    #206218

    Thanks Ismael,

    It worked on opera but not on safari on an iphone. The error message was that Safari can’t open the page because too many redirects occurred. I think the problem is that this applies to every url on my site, and so it’s infinitely redirecting to a page with a redirect on it.

    I just want to redirect one page – http://www.jonnyfreesh.com to http://www.jonnyfreesh.com/music – is it possible to do this with this plugin and different code?

    Thanks

    #206342

    Hi!

    Please try this one:

    if( wpmd_is_phone() && is_front_page() ) {
            $redirect_url = 'http://jonnyfreesh.com/music';
            header('Location: ' . $redirect_url ); // Redirect the user
    }

    Regards,
    Ismael

    #206604

    Hi Ismael,

    That one works thanks :)

    If I want to apply this to tablets as well, would I add this below it?

    if( wpmd_is_tablet() && is_front_page() ) {
    $redirect_url = ‘http://jonnyfreesh.com/music&#8217;;
    header(‘Location: ‘ . $redirect_url ); // Redirect the user
    }

    Thanks

    Jonny

    #206621

    Hey!

    Yes, I believe that is the correct code. Glad we could help. :)

    Best regards,
    Ismael

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘HomePage ReDirect on Mobile Sites’ is closed to new replies.