I wanted to use wp_tag_cloud() on single.php using the argument that gets all tags from specific category including all tags from its child categories and posts.
相关问题
- Display product ACF field value in Woocommerce tra
- Adding a custom button after add to cart button in
- How to add a “active” class to a carousel first el
- Setting custom order statuses as valid for payment
- change the font size in tag cloud
相关文章
- wordpress新增页面如何个性化设置
- select query in wordpress
- Get WooCommerce featured products in a WP_Query
- Woocommerce update shipping methods in checkout vi
- Tag multiple branches in git?
- Change order status just after payment in WooComme
- jQuery Select2 Tag on Blur
- Publishing or uploading failed. Error message: “Th
I am getting closer on this.
Thanks all for your contribution. Appreciate your help.
In your theme's functions.php insert the following function:
In your theme document call the function as follows. Notice it accepts multiple category id's:
This will return an array that you could do the following with:
There is no native way in Wordpress to do this. The reason being that tags are not tied to categories, they are separate. That being said, the only way to get all tags IN USE by a specific category is to cycle through every post of the category and grab the tags of each post.
I've written up a quick function to do just that.
Place this function into your functions.php file.
Then when you want to grab the tags of a specific category, call this function like so:
Hope this helps.
EDIT:
This is the function you will need to use in conjunction with the other:
So you can use this function simply like so: