开发者

How to change same page/post css styling from page template

How to change same page/post css开发者_Go百科 styling from page template (background, font, etc)


Add a custom class to the body tag; you could even use the post name or id for this.

Inside the loop of your page.php file you could do the following:

add_filter('body_class','my_body_classes');
function my_body_classes($classes, $class) {
    // add 'post-###' to the $classes array
    $classes[] = 'post-' . the_ID();
    // return the $classes array
    return $classes;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜