pulling in #137 with slight modifications, thx @moimikey

This commit is contained in:
Ben Word
2011-09-21 18:53:28 -06:00
parent 1f2a8f6f37
commit dedbc54e1a
2 changed files with 18 additions and 1 deletions

View File

@@ -25,7 +25,7 @@
<script defer src="<?php echo get_template_directory_uri(); ?>/js/script.js"></script>
</head>
<body <?php if (isset($post)) { body_class($post->post_name); } else { body_class(); }?>>
<body <?php body_class(roots_body_class()); ?>>
<?php roots_wrap_before(); ?>
<div id="wrap" class="container" role="document">

View File

@@ -442,4 +442,21 @@ function roots_clean_style_tag($input) {
return '<link rel="stylesheet" href="' . $matches[2][0] . '"' . $media . '>' . "\n";
}
function roots_body_class() {
$term = get_queried_object();
var_dump($term);
if (is_single())
$cat = get_the_category();
if(!empty($cat))
return $cat[0]->slug;
elseif(isset($term->slug))
return $term->slug;
elseif(isset($term->page_name))
return $term->page_name;
elseif(isset($term->post_name))
return $term->post_name;
else
return;
}
?>