If you need to display all the tags added to the current category article on the category list page, you can easily read your favorite content. The following code can help you implement this function.
First, add the following functions to the topic functions. php template file:
Expand the code:
Next, add the following output code to the appropriate location of the topic archive. php template:
<? Php
$ Cat = single_cat_title ('', false );
$ Args = array ('Categories '=> get_cat_ID ($ cat ));
$ Tags = get_category_tags ($ args );
$ Content. = "<ul class = 'cat-tag'> ";
If (! Empty ($ tags )){
Foreach ($ tags as $ tag ){
$ Content. = "<li> <a href = \"". get_tag_link ($ tag-> term_id ). "\"> ". $ tag-> name. "</a> </li> ";
}
}
$ Content. = "</ul> ";
Echo $ content;
?>
Put my feeling in the header to call the function:
<? Php get_header ();?>
Which of the following is more suitable.
Finally, add the appropriate style:
. Cat-tag {
Float: left;
Width: 100%;
}
. Cat-tag li {
Float: left;
Margin: 0 5px;
}