• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2784

Original Genesis Tutorials & 6000+ Guaranteed Code

Snippets

  • Consultation
  • Full Access
  • Log in

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

  • Show List of Posts in Same Category As Current Post
  • Related Products By Tag Else Category Else Custom Taxonomy Term – WooCommerce
  • Related Products By Same Tag Else By Same Category – WooCommerce

Taxonomy Terms

Reader Interactions

Comments

  1. Tim Burkart says

    December 31, 2022 at 3:30 am

    Hey Brad,

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

    Log in to Reply
    • Brad Dalton says

      December 31, 2022 at 4:33 am

      Well done Tim. Now you know how hooks work.

      Log in to Reply
  2. Tim Burkart says

    December 30, 2022 at 3:20 pm

    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/

    Log in to Reply
    • Brad Dalton says

      December 30, 2022 at 3:51 pm

      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 :

      Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags
 

Loading Comments...
 

You must be logged in to post a comment.