我有27个子主题, 我想按类别切换配色方案(从colors-custom到colors-dark-最终它将有更多的配色方案)
但这不起作用
add_filter( 'body_class', function( $classes ) {
if ( is_category( 'x cateorgy' ) )
{
foreach($classes as $key => $class) {
if( $class == "colors-custom" )
{
unset($classes[$key]);
}
}
}
$classes[] = 'colors-dark';
return $classes;
}, 1000);
我最初尝试了没有第一个条件if(is category())的情况, 它添加了深色, 但css不变。
#1
只需将body元素css类定位为特定类别。二十七个主题使用body_class()函数并输出所有内容的类名称。
只需为每个类别类写背景样式的CSS样式即可。
来源:
https://www.srcmini02.com/64046.html
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37533.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57