I use this code to get tags from category.
I want to display in the category page the specific tags. I have 8 categories and this is my code:
<?php if (is_category('10')) { ?>
<?php $args = array(
'categories' => '10'
);
$tags = get_category_tags($args);
$content .= "<ul>";
foreach ($tags as $tag) {
$content .= "<li><a href=\"$tag->tag_link\">$tag->tag_name</a></li>";
}
$content .= "</ul>";
echo $content; ?>
<?php } elseif (is_category('4')) { ?>
<?php $args = array(
'categories' => '4'
);
$tags = get_category_tags($args);
$content .= "<ul>";
foreach ($tags as $tag) {
$content .= "<li><a href=\"$tag->tag_link\">$tag->tag_name</a></li>";
}
$content .= "</ul>";
echo $content; ?>
.....
Do that for each category I thinks is not the best way, any idea?
! empty()
before printing the result.