Created
August 28, 2023 22:50
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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