0

If a post has tags, I would like to show only those tags as a list in the sidebar when viewing the single post; how do I do this?

I have searched to find a suitable plugin, but didn't find one, as all the ones I've looked up end up showing every tags on the site or for categories.

I'm happy to go with a non-plugin solution.

  • Plugin, Theme and hosting recommendations are off topic on this site. – kaiser Jul 3 '13 at 12:11
  • 1
    Thank you kaiser. Will bear the guidelines in mind for future quereis.My query is to find a way achieve the result without using a plugin, if possible. – Dee Jul 3 '13 at 15:03
2

This will display the tags of the current post in an unordered list:

<?php is_single() && the_tags( '<ul class="tags"><li>', '</li><li>', '</li></ul>' ) ?> 

http://codex.wordpress.org/Function_Reference/the_tags

You'll most likely want to drop this in sidebar.php.

  • I couldn't see a sidebar.php in my template. So i added this in a widget to appear on the sidebar. Works great! Thanks – Dee Jul 4 '13 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.