When your website means business.

WP/CP | Type: PHPShow Tags for Only One Category

Decided not to do this on a project after finding this snippet, but kept the snippet just in case.

query_posts('category_name=news'); if (have_posts()) : while (have_posts()) : the_post(); //replace 'news' with preferred category

    $posttags = get_the_tags();

    if ($posttags) {
        foreach($posttags as $tag) {
            $all_tags[] = $tag -> name;
        }
    }
    endwhile; endif; 

    //This snippet removes any duplicates.
    $tags_unique = array_unique($all_tags); 

    echo '

<ul>';
        foreach($tags_unique as $unique) {
          echo  '
	
	<li>'.$unique.'</li>

';
        }
    echo '</ul>

';

wp_reset_query();


Reference Links

Menu
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept