2011-04-01, 05:45:48
(This post was last modified: 2011-04-01, 05:48:29 by rhianllanes75.)
function get_body_class($class = '') {
$classes = array();
$classes[] = 'page-' . get_page_slug(false);
$classes[] = 'page-template-' . get_theme_template();
if (!empty($class)) {
if (!is_array($class))
$class = preg_split( '#\s+#',$class);
$classes = array_merge($classes,$class);
}
// Separates classes with a single space, collates classes for body element
echo 'class="' . join(' ',$classes) . '"';
}
I cant find get_theme_template defined anywhere else
EDIT: I changed the function get_theme_template() to get_theme_url(false) which is defined in the same file as get_body_class(). When I looked at the page through FIrefox, I noticed the body tag told me I was looking at page-404.
$classes = array();
$classes[] = 'page-' . get_page_slug(false);
$classes[] = 'page-template-' . get_theme_template();
if (!empty($class)) {
if (!is_array($class))
$class = preg_split( '#\s+#',$class);
$classes = array_merge($classes,$class);
}
// Separates classes with a single space, collates classes for body element
echo 'class="' . join(' ',$classes) . '"';
}
I cant find get_theme_template defined anywhere else
EDIT: I changed the function get_theme_template() to get_theme_url(false) which is defined in the same file as get_body_class(). When I looked at the page through FIrefox, I noticed the body tag told me I was looking at page-404.