我試圖做出不同的身體類,當我訪問某些類別時,它的工作完美,除了當我嘗試創建新類別然後訪問類別帖子時,它將回顯特定類別類別而不是正常的body_class();body_class wordpress加載其他類
這裏的代碼: 的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();
簡而言之:我只想在category-1中回顯特定的類,否則使用正常的body_class(); 。
任何想法爲什麼它不工作?