frankyonnetti
4/21/2016 - 3:39 PM

#wordpress add ID to body tag.

WordPress - add directory to body tag #wordpress #class #body

// Add before DOCTYPE tag.

// perishablepress.com/dynamic-body-class-id-php-wordpress
// Added by Frank@DesignHammer
$url = explode('/', $_SERVER['REQUEST_URI']);
$dir = $url[1] ? $url[1] : 'home';


// Add to body tag

id="<?php echo $dir ?>"