@Ambitious Amoeba’s answer works. But have you looked into the post_class
function? It’d do what you want, and save you a lot of trouble. Just use this as your div opener:
<div <?php post_class('box-item cocktails-box'); ?>>
where you pass the classes you want applied to all posts as a list or array, and let WordPress handle the rest (it’ll add classes for all taxonomies that the post is in, and you can filter it to add additional class depending on the view, if you want).
Related Posts:
- Hide custom field if empty
- How to add textarea field to taxonomy (tag)?
- If Term Name Exists, Append a Unique ID to Slug
- Taxonomy template is not reading
- How to assign a default/priority taxonomy to be shown in url in case two taxonomy items are selected
- Taxonomy question how to add more data
- How to get a custom taxonomy slug in body classes
- How do I append multiple taxonomies to the URL?
- Custom Taxonomy-specific JavaScript
- Exclude specific slug in ‘get_terms’
- wp_insert_term – parent & child problem
- How can I select a primary category?
- Custom taxonomy: same terms, but for different years
- Editing the Number at the end of Page URLs / Editing Page Slugs
- How to create non-unique sub-category slugs?
- get_terms return errors
- How to show only Standard Format post in my custom taxonomy page -wordpress 3.8.1
- Reproducing hierarchical list output from wp_list_categories(), using get_categories()
- Fast way to add countries as a custom taxonomy term?
- WordPress 3.1 removing ‘category’ from the slug
- How do I get the slug of a custom taxonomy category of a post?
- Auto add taxonomy if post has category
- Is there a filter hook that I can use to change how taxonomy term names are displayed?
- Remove Taxonomy Slug when No Taxonomy is Assigned to Custom Post Type?
- How to Register and Display Widget for Custom taxonomy
- how to flush custom author rewrite rule
- Show Custom Taxonomy Slug(s)?
- Remove Author Slug & Replace With Username
- Removing the “Popular Terms” area from the Taxonomy Edit Screen in the Admin Area
- How can I get the page url slug when ‘post_name’ returns an id?
- Custom Taxonomy Archive not displaying entries
- Exclude custom taxonomy tag from loop
- Filter posts by custom taxonomy terms
- Rename “Portfolio” slug?
- list/consult Taxonomy only for the respective author/creator in dashbboard
- Identical custom taxonomy slugs for same hierarchical children
- Function to remove archive sidebar for custom taxonomy?
- Display Taxonomy Terms in an option tag with value being the slug
- Changing taxonomy term by slug (wp_update_term)
- WordPress slugs and 404 handling takes preference over folders in site root?
- Automatically check parents (in a taxonomy) when child is selected
- How can I get the custom post type assigned to a current custom taxonomy for query?
- wp_query get post custom taxonomy in search.php
- Replace taxonomy permalinks
- Remove Custom Post Type Slug and add Custom Taxonomy to Permalink Structure?
- Redirect to another page using contact form 7? [closed]
- How to get every custom taxonomy names and urls?
- Get Custom Taxonomy Terms by Date
- Rename a slug label
- Display specific Taxonomy Term from Custom Post Type
- Don’t change Custom Post Type slug to unique value
- Semi complicated custom taxonomy question
- How do I list custom taxonomy terms with the links?
- Changing CPT slug and taxonomy already registered in parent theme
- How to display page ids as page slug names?
- Taxonomy Overview Page?
- Query Multiple Custom Post Types & Exclude a Taxonomy Term
- Echo the Last Child Taxonomy only (not parents)?
- How to query term_id of a Custom Taxonomy by name
- Use wp_list_categories to list parent categories from actual term
- How to show parent taxonomy using get_the_terms?
- wp_insert_post custom taxonomy multiple Category not added
- query variables for custom taxonomies
- optimal taxonomy or custom post types
- How can i display a taxonomy? i have created a plugin and then a custom type. and a taxonomy , also i have register it
- Display all subterms of a custom taxonomy filtered by parent terms
- My list of terms of custom taxonomy displays 7 times
- Adding a custom field to a slug
- Query Product categories what have a custom field
- Can I overwrite custom taxonomy FROM “public” TO “false”
- Display Custom Taxonomy Name As A Shortcode
- URL issue after setting up Custom Structure in Settings >> Permalinks
- Set a Default CPT taxonomy by taxonomy id
- Post filter with multiple checkbox taxonomy terms
- generate random slug when adding taxonomy
- Combine Categories & Custom Taxonomy
- Customizing URL slugs of Custom Post Type and Taxonomy make posts/pages 404
- Custom dropdown search form that allows users to select option B based from Option 1
- issue with saving custom metaboxes fields
- How to add a post with new Taxonomy without assigning to default category?
- Change order custom taxonomy
- Taxonomy template by post type
- How to loop through 1 CPT with 2 Taxonomies
- Display taxonomy term slugs
- Sort by Custom Post Type (Multiple Loop)
- Custom terms in custom category taxonomy
- How to keep the /blog slug even in single post slug
- How to setup a taxonomy that can have only one post assigned to it?
- Grouped custom taxonomy query
- Create advanced portal website with sections – taxonomy usage?
- Custom Query for Taxonomy
- Custom Import with taxonomies
- Adding a third custom taxonomies
- Custom Search only for my Custom Taxonomy Page – data
- Same slug for Custom Taxonomy archive and CPT archive – Rewrite rule not working
- Taxonomy Archive URL + Template
- Custom post type URl Cutomization
- next/previous stays within specific taxonomy term when in single post
- How to: Easily Move a WordPress Install from Development to Production?
- Is there a flowchart for WordPress loading sequence?