• Hi guys and girls,

    I am creating a mobile version of my site using an alternative theme. I have installed a plugin that detects whether the user is using a mobile, desktop or tablet but my problem is that I want to have two different static layouts for my homepage of the mobile site and that of the desktop/tablet version.

    I know i probably need to dabble with the PHP of the themes but I am not 100% sure what I need to do in order to display different pages depending on what device is being used as my php skills are not that advanced compared to my other skills.

    Can someone please give me a little bit of guidance.

    Many thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Well, let’s say is_mobile() function returns true if the user is on mobile device and otherwise it returns false.

    You can duplicate each theme files for mobile with “-mobile” suffix. Like;
    single.php and single-mobile.php

    In single.php

    <?php
    
    if ( is_mobile() ) :
        require( get_template_directory_uri() . '/single-mobile.php );
    else :
        // Here will be your desktop design
    endif;
    ?>

    This is my approach to your issue. Better ideas may come.

    But I suggest you to use a “Responsive Theme” which is is an approach to web development that allows a website to break itself down smoothly across multiple monitor sizes, screen resolutions, and platforms, be it a computer, tablet or mobile device.

    Thread Starter jawilsondesign

    (@jawilsondesign)

    Thanks Firat,

    The website is responsive but on mobile it leaves quite a bit to be desired in terms of UI and graphics thus why I want a different theme for the mobile with swipe features & click to call buttons etc but still maintaining the graphical look and feel of the brand.

    I think i read somewhere about putting some php code in the functions.php file of both themes but im a bit unsure where to place it as I know php gets all moody if you put it in the wrong place.

    Thanks for your response though, definitely going to study some more php as it’s good to know whats under the bonnet so they say ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to create two different static homepages’ is closed to new replies.