Revision: 61535
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 20, 2012 05:38 by almendro
Initial Code
<?php
$body_id ="";
if ( is_single() || is_page() ) {
$body_id = ' id="'.$post->post_name.'" ';
} else if ( is_category() ) {
$category = get_the_category();
$body_id = ' id="category_'.$category[0]->category_nicename.'" ';
}
?>
<body <?php body_class(); ?> <?php echo $body_id; ?> >
Initial URL
Initial Description
Add an ID to the body tag.
Initial Title
WP body id width post-name or category-nicename
Initial Tags
wordpress
Initial Language
PHP