• Resolved pakpenyo

    (@pakpenyo)


    Hi

    Thanks a lot for plugin.

    I know the plugin is add class to body. But i want to know if it’s possible to html class instead the body class? For example, use html5-boilerplate head tag when using desktop, and use mobile-boilerplate head tag when using mobile.

    Thanks again and really sorry about my english.

    https://wordpress.org/plugins/mobble/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello, pakpenyo.

    This would be possible, but is currently not set-up to work this way.

    Perhaps in a future update I can try adding this option to a config page.

    Thanks for the idea,
    Atg

    Plugin Author Scott

    (@scottsweb)

    This would actually be very easy to do. In your themes header.php you would need to add something like:

    <html class="<?php echo mobble_body_class(); ?>">

    Enjoy

    Thread Starter pakpenyo

    (@pakpenyo)

    @aaron,
    I use the plugin without config page. I’ve done implement this plugin to my theme function (using roots framework with custom css, not bootstrap).

    @scott,
    I have not try it but i think it will produce duplicate class between html and body.

    Plugin Author Scott

    (@scottsweb)

    It won’t duplicate the classes providing the setting in the theme options remains unchecked.

    Thread Starter pakpenyo

    (@pakpenyo)

    It’s not working scott.

    only Array at html class. From wp_debug:

    Array to string conversion
    Missing argument 1 for mobble_body_class()

    head.php
    <html class="no-js <?php echo mobble_body_class(); ?>" <?php language_attributes(); ?>>

    Plugin Author Scott

    (@scottsweb)

    O yes. Apologies. Try this instead then:

    Add the following to your theme functions.php file:

    if ( function_exists('mobble_body_class') ) { 
    
       function mobble_html_class() {
           $array = mobble_body_class();
           return implode( " ", $array);
       }
    }

    Then on in your head.php:

    <html class="no-js <?php if ( function_exists('mobble_html_class') ) { echo mobble_html_class(); } ?>" <?php language_attributes(); ?>>

    That extra function will convert the array to a string.

    Thread Starter pakpenyo

    (@pakpenyo)

    That’s great! It’s work fine.
    Thanks a lot scotts.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘HTML Class’ is closed to new replies.