• Resolved Paul Bursnall

    (@style960)


    I’m using Buddyboss 3.1.5 and would like to use this plugin to detect and load one of two header.php files – depending on whether this site is viewed from mobile or tablet/desktop.

    Can you advise please?

    I’m assuming once the two relevant header files are in my child theme and the plugin is activated, I can put something in the functions.php files to trigger this but I can’t seem to get it right.

    I tried the examples you have in FAQ just for interest but they all return the same error “Parse error: syntax error, unexpected ‘<‘ in /home/xxxx/public_html/dev/wp-content/themes/buddyboss-child-fixed-header/functions.php on line 59”

    Would be great it I could get this working.

    Thanks,
    Paul.

    https://ww.wp.xz.cn/plugins/mobble/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Scott (@scottsweb)

    (@scottsweb)

    Hi Paul
    The simplest way would be to replace your calls to get_header(); within your template with something like:

    <?php
    if (is_mobile()) {
       get_template_part('header', 'mobile');
    } else {
       get_header();
    }
    ?>

    You would then create a file within your theme called header-mobile.php and place your alternative header in there.

    Thread Starter Paul Bursnall

    (@style960)

    Excellent, thanks for the quick reply, I’ll give it a try.

    Thanks again,
    Paul.

    Thread Starter Paul Bursnall

    (@style960)

    I’ve not been able to get this working. Header-mobile.php is the default theme header, and header.php is my modified header.

    Site is running Buddyboss – http://dev.everygoalmatters.com

    I’ll maybe have to take it up with the theme developers.

    Thanks.

    Plugin Author Scott (@scottsweb)

    (@scottsweb)

    If your web server or site uses caching then it may not work with mobble… so I would check that too. Failing that I am not sure what to suggest.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Switch header files’ is closed to new replies.