Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I'm looking to show the tags of a post within a widget. I know this is hard because it's outside of the loop, but has it been done, is there one available?
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.
<?php the_tags(); ?>
Check Tags Documentation to tweak display order.
All done just rock and roll.
Its not very hard actually, WordPress supports multiple loops and query's.
The best way to create a secondary (or more) loop is to make an instance of WP Query
Using that you can make a simple query that gets the posts tags using wp_get_post_tags
Then you would throw the code into a widget.
Required, but never shown
7 years, 11 months ago
3 years, 4 months ago