【发布时间】:2015-04-15 18:33:07
【问题描述】:
当我访问某个类别时,我尝试创建不同的正文类,它工作完美,除非我尝试创建新类别然后访问类别帖子,它会回显特定的类别类而不是正常的 body_class();
这里是代码: header.php:
<?php
$catid1 = get_cat_ID( 'פאודה צפייה ישירה' );
$currentcatID = the_category_ID($echo=false);
if(is_single() && $catid1 == $currentcatID){
$catid1 = $catid1;
}else{
$catid1 = $currentcatID;
}
?>
<body <?php
if(!empty($currentcatID)){
if(is_single()){
if($catid1 == $currentcatID){
echo 'class = "rtl single single-post category-'.$catid1.' postid-81 single-format-standard featured-image-only"';
}else{
body_class();
}
}else{
body_class();
}
}
?>>
当我访问索引站点时一切正常,当我访问该类别 id 的页面也正常工作但创建新类别并添加测试帖子时,它会回显第一类 echo 'class = "rtl single single-post category-'.$catid1.' postid-81 single-format-standard featured-image-only"';
我不想要,我想回应 body_class();
简短:我只想在类别 1 处回显特定类,否则使用普通 body_class(); .
知道为什么它不起作用吗?
【问题讨论】:
标签: wordpress