This code enables you to display post tags by the current category when viewed on each category archive page. It displays a tag cloud of post tags assigned to posts within the current category archive.
The code loops through all posts assigned to each category and displays tags assigned to each post on the category archives as seen in the demo video.
Demo Video
Shows tags for posts on the current category archive page.
Tested using the Genesis Sample child theme by StudioPress & the Twenty Twenty default theme for WordPress.
Parameters
You can display your tags using the flat or list format and use any of the following parameters to customize the output.
Installation – Genesis
There’s only 1 step.
Upload the file named category.php to your child theme folder.
Installation – Other Themes
There’s 2 steps relating to usage of the code from the folder named tag-cloud:
Step 1 : Copy & paste the PHP code from functions.php to the end of your child themes functions file.
Step 2 : Paste the following template tag in your category.php template in your child theme. Included is a category.php template for the Twenty Twenty WordPress theme.
tag_cloud_by_current_category();
And here’s what you get on the Twenty Twenty category page :
Was This Tutorial Helpful?