I’m using a small code to display a tag list for the current categories like below:
<?php
$custom_query = new WP_Query('posts_per_page=-1&category_name=overnachten');
if ($custom_query->have_posts()) :
while ($custom_query->have_posts()) : $custom_query->the_post();
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
$all_tags[] = $tag->term_id;
}
}
endwhile;
endif;
$tags_arr = array_unique($all_tags);
$tags_str = implode(",", $tags_arr);
$args = array(
'smallest' => 12,
'largest' => 12,
'unit' => 'px',
'number' => 0,
'format' => 'list',
'include' => $tags_str
);
wp_tag_cloud($args);
?>
It currently displays the tags used by the posts in one certain category. I want to use the above code to display all the tags from the category I’m currently in. How would this be possible, with the above code or a better way?
Try referencing the cat query variable like so: