get_tags Includes All Post Tags In Array
-
I’m trying to add Tags to a Category List and I’ve been successful, but my issue, they’re not just returning their own tags but the tags for every post.
Example – How it Should Be:
Post 1: [Tag 1]
Post 2: [Tag 2]
Post 3: [Tag 3]Example – How It Is:
Post 1: [Tag 1] [Tag 2] [Tag 3]
Post 2: [Tag 1] [Tag 2] [Tag 3]
Post 3: [Tag 1] [Tag 2] [Tag 3]I pulled the following code from the codex:
<?php $tags = get_tags(); $posttags = '<div class="post_tags">'; foreach ( $tags as $tag ) { $tag_link = get_tag_link( $tag->term_id ); $posttags .= "<a href='{$tag_link}' title='{$tag->name}' class='{$tag->slug}'>"; $posttags .= "{$tag->name}</a>"; } $posttags .= '</div>'; echo $posttags; ?>
Any help or direction is greatly appreciated!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘get_tags Includes All Post Tags In Array’ is closed to new replies.