mEthoxE mEthoxE - 6 months ago 13
PHP Question

Where is the body tag in this WordPress theme?

I need to add the ID 'skrollr-body' to the body tag of my website but I can't find the opening body tag anywhere. Its a very simple change I know, but the website isn't mine and directory structure is very messy and he's asked me to resolve the issue of the website not scrolling on mobile/tablet (which is due to the body tag not having the ID 'skrollr-body').

The theme inherits from Genesis, and in the header.php I found this which does mention the body tag, can I add an ID in this snippet of code at all ? -

genesis_markup( array(
'html5' => '<body %s>',
'xhtml' => sprintf( '<body class="%s">', implode( ' ', get_body_class() ) ),
'context' => 'body',
) );


Also, the header.php in the theme it self has nothing to do with the opening body tag:

<div class="one-third first">
<a href="">
<img src="" />
<img src="" />
</a>
</div>
<div class="two-thirds">
<div>
<p></p>
</div>
<div id="callus">
<a href=""></a>
</div>
</div>


Any help would be greatly appreciated, if this was a static site instead of a dynamic site with a CMS it would be easiest change possible, but this WordPress directory is so messy and disorganised I can't locate the tag at all.

I almost thought about implementing some jQuery to amend the tag but that seems a bit over the top for such a simple change.

Cheers.

Answer

Try with this:

genesis_markup( array(
    'html5'   => '<body %s>',
    'xhtml'   => sprintf( '<body id="skrollr-body" class="%s">', implode( ' ', get_body_class() ) ),
    'context' => 'body',
) );

Or with this:

genesis_markup( array(
    'html5'   => '<body id="skrollr-body" %s>',
    'xhtml'   => sprintf( '<body id="skrollr-body" class="%s">', implode( ' ', get_body_class() ) ),
    'context' => 'body',
) );
Comments