• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Does Genesis Use Body_Class()?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Does Genesis Use Body_Class()?

This topic is: not resolved
  • This topic has 4 replies, 4 voices, and was last updated 11 years, 8 months ago by depi.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • August 26, 2014 at 12:58 pm #121177
    foodin65
    Member

    I'm using the WP-Bakery Visual Composer plugin with my custom genesis child theme. The columns classes aren't working and I checked with their support, they said the most likely cause was missing Body_Class() function in the header template.

    ******Their Response*******
    Can you check if the theme is missing body_class(); function call in the body tag in html (most likely in header.php file)
    https://codex.wordpress.org/Function_Reference/body_class
    We hugely rely on wp_head(); body_class(); and wp_footer(); in the theme.
    ******My Reply**********
    I looked through the theme files and found both the wp_head(); and the wp_footer();
    But I could find the body_class();

    The closest thing I found was this:
    genesis_markup( array(
    'html5' => '<body %s>',
    'xhtml' => sprintf( '<body class="%s">', implode( ' ', get_body_class() ) ),
    'context' => 'body',
    ) );

    in the header file. Will that work?
    *******Their Response**********
    The get_body_class function: http://codex.wordpress.org/Function_Reference/get_body_class is different from the body_class: https://codex.wordpress.org/Function_Reference/body_class
    I will recommend you to add the body_class function to the body tag, so our plugin can work fine. If you are not sure as to where the body tag is present in the theme, you can get in touch with the theme author.
    ********End Discussion*******

    So my question is this: Where is the body_class() function in genesis? Is it being used or is it missing and I need to add it? Or is something else entirely going on here?

    Thanks!

    http://www.ohpananaturals.com/philosophy/
    August 26, 2014 at 2:08 pm #121190
    Genesis Developer
    Member

    Genesis using the body_class() function and added the Class using filter method. You can find the code (add_filter( 'genesis_attr_body', 'genesis_attributes_body' );) in lib/functions/markup.php file.


    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    August 26, 2014 at 2:11 pm #121191
    Nick
    Participant

    You don't need to modify your child theme to add an additional body_class() in the header file. Custom body classes are already added to all Genesis child themes by the genesis_markup function you highlighted.

    For HTML5 themes, the code that adds body classes is located in /genesis/lib/functions/markup.php in the genesis_attributes_body() function:

    function genesis_attributes_body( $attributes ) {
    
    	$attributes['class']     = join( ' ', get_body_class() );
    	$attributes['itemscope'] = 'itemscope';
    	$attributes['itemtype']  = 'http://schema.org/WebPage';
    
    	return $attributes;
    
    }

    WordPress's body_class() and get_body_class() functions are identical except that body_class outputs the classes as a space-separated list so that you can use it directly in your template, while get_body_class() returns the classes as an array that can be stored or used within a function, just as Genesis does. (If you're curious, you can even view the WordPress source code directly to see that the body_class() function simply calls get_body_class() to echo a space-separated list of the body classes – it's simply a helper method, not a “different” one as you've been told.)

    Rest assured that Genesis is coded correctly – using get_body_class() is perfectly fine in this case.

    It's likely that the problem lies elsewhere – there's possible a classname conflict with the column names that Visual Composer uses. Are you able to identify the column classnames it's adding, and the corresponding styles for those classes, then double-check that they're not being overridden by Genesis' own column classes? (Happy to walk you through this here if you need more help.)

    August 26, 2014 at 2:29 pm #121192
    Nick
    Participant

    By the way, a quick check of the source for the link you posted shows that the wpb-js-composer js-comp-ver-4.3.3 vc_responsive are being added to the body class correctly. Those sound like they're all related to Visual Composer to me, which confirms there's no problem with the body_class() styles.

    But I couldn't see any CSS that would style your divs with the vc_row wpb_row vc_row-fluid classes to lay them out as columns – it seems like some of the Visual Composer styles may be missing.

    October 16, 2014 at 9:56 am #128009
    depi
    Participant

    Hi foodin65,

    was your problem resolved?

    Is WP-Bakery Visual Composer compatible with Genesis?

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble