Add custom body class for specific pages
wordpress snippet
Adding this snippet to the functions.php of your wordpress theme will let you add a custom body class for specific pages. Add the second snippet to the header.php template replacing your default html body tag.
snippet : PHPcopy
add_filter( 'body_class', 'my_neat_body_class');
function my_neat_body_class( $classes ) {
if ( is_page(7) || is_category(5) || is_tag('neat') )
$classes[] = 'neat-stuff';
return $classes;
}
snippet : PHPcopy
<body <?php body_class(); ?>>
this months featured snippets
- http://www.squareonemd.co.uk Elliott the web design guy
- http://wpsnipp.com Kevin Chard
- http://twitter.com/jamusreynolds Jamie Reynolds
- http://wpsnipp.com Kevin Chard
- Anonymous
- http://wpsnipp.com Kevin Chard
- Jhardy1974
- http://wpsnipp.com Kevin Chard






