Hi,
I am trying to add some dynamically (based on the URI) created class names into the standard body_class() statement.
The codex mentions to put the class into the brackets while using the body_class('add-class-here')
however I have 2 variables that I need to echo out inside the body class="" so I tried doing it as follows:
<?php
$url = explode('/', $_SERVER['REQUEST_URI']);
$dir = $url[2] ? $url[2] : 'home';
$subdir = $url[3] ? $url[3] : '';
?>
<body <?php body_class(<?=$dir?><?=($subdir?' ':'')?><?=$subdir?>); ?>>
This however results in a PHP error thus breaking the page.
Any ideas how I can add my variables into the body class while keeping the standard generated classes of the body_class() function?
Thanks for reading.
Jannis