WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a widget which displays the latest projects as thumbnails on my website. When I mouse over a thumbnail the project title appears; this is the code for title:

<h2><?php echo get_the_title(); ?></h2>

So, I'm thinking to display also the tags from that specific project, to be something like beautiful, nature, landscape

Is this possible, or could you give me some suggestions on how to achieve this ? Thanks!

share|improve this question
does codex.wordpress.org/Function_Reference/the_tags not do what you want? – Michael May 18 '12 at 9:38
up vote 2 down vote accepted

By what code you've posted, it seems like you've got a secondary loop set up (using a WP_Query object). So to display the current' posts tags you can use:

  • the_tags - to print a list of the post's tags
  • wp_tag_cloud - to print a tag cloud.
  • get_the_tags - to return an array of tag objects, which you can then use to display the tags however you'd like.
share|improve this answer

Tags can be shown outside the Post loop using the global functions.

Step 1 : Get a PHP Code Widget (this solved many problems)

Step 2 : Place the Code <?php the_tags(); ?> in widget and Save.

Check Tags Documentation to tweak display order.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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