I have a project that requires me to list out the available terms for each custom post type and indicate visually which of the terms/categories are empty via css/javascript. Is there a way to return a list of terms/categories and say add a class to the empty ones ? Thanks for any and all assistance.
相关问题
- 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新增页面如何个性化设置
- Web Test recorder does not allow me to record a te
- select query in wordpress
- Factory_girl has_one relation with validates_prese
- Get WooCommerce featured products in a WP_Query
- Woocommerce update shipping methods in checkout vi
- What is the difference between `assert_frame_equal
- js if any value in array is under or over value
Yes there is. First you get your terms using get_terms() (I'm assuming your cpt has associated taxonomy with it)
This should do it.
EDIT
After
$custom_terms
variable do aprint_r($custom_terms);
to see what the variable holds. You should get an array filled withstdClass Object
s, one for each category in this taxonomy.So you can further do something like this:
This will show you names of non empty categories in your taxonomy.