簡體   English   中英

如何從 get_tags() output 中刪除“標簽:”

[英]How to remove “Tags:” from get_tags() output

我正在使用 WordPress 的網站上工作,並希望使用 function 顯示與帖子關聯的標簽:

get_tags();

但是,此 function 不僅顯示帖子的標簽,還在顯示所有標簽之前輸出了文本“標簽:”。 我想將此文本更改為更現代的內容,例如圖標,或者將其全部刪除。 是否有某種論點可以傳遞給這個 function 以實現我的目標,如果沒有,我該怎么辦? 這是我來自“single.php”的代碼片段:

<h4 class="singleposttags"><?php the_tags(); ?></h4>

嘗試設置第一個參數

the_tags('<i class="your-icon"></i> ');

它應該允許您使用 HTML 字符串作為參數。 閱讀更多https://developer.wordpress.org/reference/functions/the_tags/

然后風格

.your-icon {
    // ...
}

請使用這個,我希望它一定會奏效。

the_tags('<span class="class_name"></span> ');

<style>
    .class_name
    {
    //Your css attributes will be here.
    }
</style>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM