BuddyBoss Home – Web Support Forums Themes Boss. theme Desktop/Mobile Front Page

Viewing 6 posts - 1 through 6 (of 6 total)
  • Question

    #38551

    Anonymous
    @

    Is it possible to display a different front page (homepage) on smart phones as compared to desktop and tablet?

    Answers

    #38564

    Anonymous
    @

    Hi @ryanmaler, you can use create some conditional logic using wp_is_mobile
    ref url
    https://codex.wordpress.org/Function_Reference/wp_is_mobile

    example

    function mobile_home_redirect(){
        if( wp_is_mobile() && is_front_page() ){
            include( get_template_directory() . '/home-mobile.php' );
            exit;
        }
    }
    add_action( 'template_redirect', 'mobile_home_redirect' );

    with the above function you just need to create file with name home-mobile.php inside the child theme folder which contain the page template what you want to use for mobile devices.
    Thanks
    Varun Dubey

    #38573

    Anonymous
    @

    @vapvarun Sounds like exactly what I’m looking for. I’m going to play around with the template a bit. Thanks Varun.

    #38814

    Anonymous
    @

    @vapvarun I have one question. How do I specify which wordpress page I want to show as the mobile homepage?

    #38817

    Anonymous
    @

    @vapvarun never mind Varun. I decided to go a route using visual composer’s nift row hiding feature to hide desktop items and show mobile items. I may revisit this if the visual composer route does not pan out. Thanks

    #38826

    Anonymous
    @

    no issue, those are just minor code edits to display any pages as front page

    Regards
    Varun Dubey

Viewing 6 posts - 1 through 6 (of 6 total)
  • The question ‘Desktop/Mobile Front Page’ is closed to new replies.