Pull in the tags related to a category

This is a way to show all tags related to a category, without returning them in a list. This is a great way of adding more SEO, and kill some bounce rate.

Just make sure you change the name of your category where the category_name= starts. Use spaces if your category is named using more than one word.

Put this code where you want the tags to be displayed.

Code Snippet:

$project_query = query_posts('category_name=Real estate marketing');
while (have_posts()) : the_post();
    $posttags = get_the_tags();
    if ($posttags) {
        foreach($posttags as $tag) {
            $all_tags_arr&#91;&#93; = $tag -> name; //USING JUST $tag MAKING $all_tags_arr A MULTI-DIMENSIONAL ARRAY, WHICH DOES WORK WITH array_unique

$tags_arr = array_unique($all_tags_arr); //REMOVES DUPLICATES
foreach( $tags_arr as $tag ):
    $el = get_term_by('name', $tag, 'post_tag');
    $arr[] = '"tag-'.$el->slug.'"';
&lt;span>&lt;a href="<?php echo bloginfo('url'); ?>/tag/<?php echo $el->slug; ?>" id="taglink-tag-<?php echo $el->slug; ?>" rel="tag-<?php echo $el->slug; ?>"><?php echo $el->name; ?>&lt;/a> &lt;span class="slash">, &lt;/span>&lt;/span>
<?php endforeach; ?>

Posted in Pure hacks