Using body_class() in PODS CMS for Wordpress
I have been playing around with a CMS plugin for Wordpress called PODS. Here is a function for functions.php which might come in useful if you want to add POD page URL variables and page pod types to your body class:
function pods_body_class($classes)
{
global $pods;
if ( is_pod_page() )
{
$classes[] = "pod";
if( is_object($pods) )
{
$classes[] = "pod-".$pods->datatype;
}
$classes[] = ' '.pods_url_variable(-2).' '.pods_url_variable('last');
}
return $classes;
}
add_filter('body_class','pods_body_class');
The body_class function is a useful built in Wordpress function that prints the page_id, blog post category etc. to the class names for the body element. It can be implemented like so:
<body <?php body_class(); ?>>
When implemented with the above code, this will return the last two URL variables, i.e. for the rewritten URL example/parent/child/. If the POD was 'cars' this would return body class names like this:
pod parent child
If you assign corresponding class names to your sub-navigation elements (e.g. <ul class="parent">) you can then use CSS to highlight active menus like so:
.parent .parent { font-weight:bold };
Enjoy!