Display Article tags
-
Hi.
Sorry if this is a simple question but I’m new to PHP. I’m trying to add article tags to the bottom of the single template, but it appears get_the_tags() only returns post, not article tags. Does anybody know how I get the article tags?
$posttags = get_the_tags(); if ($posttags) { $array = []; foreach($posttags as $tag) { $array[] = '<a href="/tag/' . $tag->slug . '/">' . $tag->name . '</a>'; } echo "<h2>Tags: </h2><p>" . implode(', ', $array) . "</p><br>"; } else { echo "<script>console.log('No tags');</script>"; }
Cheers,
Andrew.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Display Article tags’ is closed to new replies.