Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'body_class', 'my_foo_body_class'); | |
function my_foo_body_class( $classes ) { | |
if ( is_page(7) || is_category(5) || is_tag('bar') ) | |
$classes[] = 'foo'; | |
return $classes; | |
} | |
?> | |
/*body_class()にclassを加える*/ | |
<body <?php body_class(); ?>> |
Screen shot
Note
Description | 特定のカテゴリやタグのアーカイブページのbody_classに任意のclassを追加する |
---|---|
WordPress Ver. | 3.3.1 |
Via | – |