我正在創建一個WordPress主題,並且我在主題中的每個類別都有指定的顏色。我想要的wordpress代碼只是打印出類別的名稱到帖子的ID,所以它可以設置爲相應的顏色,但是我嘗試的每個代碼都會給它添加html標記,這會弄亂我的代碼。以下是我希望如何工作。如何在沒有任何標記的情況下打印Wordpress帖子的分類,只是純文本?
<article> <!-- POST -->
<h1>Post title</h1>
<h2 id="***Here is where I want to insert the code to print the post's category id***>Category Name (Same code as in the ID)</h2>
<img *featured image*>
<p>blah blah article summary</p>
</article>
任何幫助將非常感激!
是這個類別中的頁面?或在列出多個帖子的頁面上? – Mark