Post Tags By Current Category

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.

WP Tag Cloud Parameters

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 :

Download Folder

Related Tutorials


Comments

4 responses to “Post Tags By Current Category”

  1. Tim Burkart Avatar
    Tim Burkart

    Hey Brad,

    I’ve got it all setup and working! Thank you very much.

    1. Well done Tim. Now you know how hooks work.

  2. Tim Burkart Avatar
    Tim Burkart

    Hi Brad,

    So far so good! However, how can I control the placement of the tag cloud? My current category archive already has widgets and I would like to place the tag cloud at the bottom with a title. Here is a link to a site I am developing – https://dot832.dev/collabsion/category/news/

    1. Change the hook from genesis_before_sidebar_widget_area to any other https://wpsites.net/genesis-hooks/ on line 8 of category.php. If you want the cloud at the end of your sidebar widget area use genesis_after_sidebar_widget_area. If you want the cloud after the loop, use genesis_after_loop.

      To add the title add this around line 42 :

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.