0
我需要使用類別名稱作爲H1的類,並且還需要排除類別2.所以我將下面的PHP代碼拼湊在一起。它工作正常,除了文章丟失格式。我知道get_post_format()
是什麼格式的應用,但是當我添加它時,它似乎沒有做任何事情。任何幫助將不勝感激,謝謝。獲取文章格式
<?php while (have_posts()) : the_post();
$excludedcats = array(2);
$count = 0;
$categories = get_the_category();
foreach($categories as $category)
{
$count++;
if (!in_array($category->cat_ID, $excludedcats))
{
echo '<h1 class="category-heading ' . sprintf(__("heading-%s"), $category->slug) . '" >';
if($count != count($categories))
{
echo " ";
}
}
}
single_post_title();
echo '</h1>';
the_content();
?>