Community Forums › Forums › Archived Forums › General Discussion › Does Genesis Use Body_Class()?
- This topic has 4 replies, 4 voices, and was last updated 9 years, 6 months ago by depi.
-
AuthorPosts
-
August 26, 2014 at 12:58 pm #121177foodin65Member
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 #121190Genesis DeveloperMemberGenesis 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.
August 26, 2014 at 2:11 pm #121191NickParticipantYou 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 thegenesis_markup
function you highlighted.For HTML5 themes, the code that adds body classes is located in
/genesis/lib/functions/markup.php
in thegenesis_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()
andget_body_class()
functions are identical except thatbody_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 thebody_class()
function simply callsget_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 #121192NickParticipantBy 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 #128009depiParticipantHi foodin65,
was your problem resolved?
Is WP-Bakery Visual Composer compatible with Genesis?
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.