Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save scottnunemacher/43fb351485e7adf2015c8c7f683449ba to your computer and use it in GitHub Desktop.
Save scottnunemacher/43fb351485e7adf2015c8c7f683449ba to your computer and use it in GitHub Desktop.
Wordpress - Display Loop's Post Tag Links - Ex: display tag links for an article
<?php
// Will output links displayed like:
// Tags: Article Tag | Other Article Tag | Another Article Tag
$post_tags = get_the_tags();
$separator = ' | ';
$output = '';
if (!empty($post_tags)) {
echo "Tags: ";
foreach ($post_tags as $post_tag) {
$output .= '<a href="' . get_tag_link($post_tag) . '">' . $post_tag->name . '</a>' . $separator;
}
echo trim($output, $separator);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment