Hi,
I use the following code in my category sidebar to check which tags are used in the category. It works, but only for the first 9 posts (the first page displays 9 posts.) How can I change this code so it also checks for the other posts in this category?
<?php
if (is_category()){
$cat = get_query_var('cat');
$yourcat = get_category ($cat);
}
$tag_IDs = array();
query_posts('category_name='.$yourcat->slug);
if (have_posts()) : while (have_posts()) : the_post();
$posttags = get_the_tags();
if ($posttags):
foreach($posttags as $tag) {
if (!in_array($tag->term_id , $tag_IDs)):
$tag_IDs[] = $tag->term_id;
$tag_names[$tag->term_id] = $tag->name;
$tag_slug[$tag->term_id] = $tag->slug;
endif;
}
endif;
endwhile; endif;
wp_reset_query();
$getTag = $_GET["tag"];
if ($getTag == '') {
$tag_showall = 'checked';
}
if (!empty($tag_IDs)){
echo '<h3>Aanbieders</h3>';
echo '<input type="radio" name="tag" value="" '.$tag_showall.'> Alles weergeven<br>';
}
foreach($tag_IDs as $tag_ID){
$checked = $tag_slug[$tag_ID];
echo '<input type="radio" name="tag" value="'.$checked.'"' ;
if((isset($_GET["tag"])) && $_GET["tag"] == $checked) {
echo ' checked="checked"';
}
echo '> '.$tag_names[$tag_ID].'<br>';
}
?>