You kind of not telling what the problem is, like debug, error message you get. There is most likely something wrong with how you wrote that, I’m not willing to go trough this right now. But generally you should make this cleaner and separate parts for an better structure, regarding the taxonomy name as id for the div see below simplified example on how I’d do this:
$term_obj = wp_get_post_terms(get_the_ID(), 'example-taxonomy', array("fields" => "names"));
echo '<div class"example" id="'.$term_obj[0].'">EXAMPLE</div>';
Related Posts:
- Glossary with Custom Post Type
- Weird problem happening with custom taxonmy when creating/updating posts
- Custom Post Type Archive Page Filtering
- Allow user to set custom order to a list of custom taxonomies?
- Hide parent categories when clicked, and show it’s childs
- How to get custom posts sub category link
- Get parent category id from child category page for custom taxonomy
- How to Display Posts From Category Within a Custom Taxonomy?
- The Difference Between Categories and Tags and Taxonomies and Terms
- Displaying One Custom Post Type’s Content On Single Post of Another Custom Post Type
- Retrieve Custom Taxonomies with Description and Slug
- How to list posts by term (custom taxonomy)
- Custom taxonomy not saving correctly
- Using get_terms() to list terms from one custom taxonomy AND from one specific built-in category
- How to display custom taxonomy term specific post?
- Set a Default CPT taxonomy by taxonomy id
- Help with Travel Guide Setup
- Get a list of categories ids
- Using get_terms() as shortcode attribute
- Get The Post Type A Taxonomy Is Attached To
- How to limit the number of terms (terms acts like categories)
- How can I list all the categories under a Custom Post Type (taxonomy)?
- How can I select a primary category?
- Not Able to Insert Taxonomy Term Using wp_insert_post()
- array_pop() expects array, boolean given for $event_type_term ->slug
- Displaying custom post type by first letter through custom taxonomy
- Trouble adding custom featured image for custom taxonomy TERMS
- Custom edit post column – category not showing
- Creating a function that receives the taxonomy terms that have been changed in a custom post type
- Custom post type taxonomy template
- Get the terms of a custom taxonomy for a specific author in author template
- Best practice for adding posts in bulk
- WP 3.1 getting tax_query to work in query_posts()
- get_categories() for only CPT
- Category page only displaying the posts from a custom type
- custom taxonomy archive by year
- How to get posts from multiple custom post types according to it’s custom taxonomy terms?
- Displaying a custom post types custom taxonomy value?
- Update post terms with custom taxonomy
- Filtering WP_Query Dynamically on the Front-End
- Get template part using a custom taxonomy term
- How to restrict users and admin from creating new taxonomy terms?
- Displaying custom taxonomy in the admin list of a custom post type
- Conditional Query of Custom Post Type and custom taxonomy
- Show a Category X’s custom post type on Category X archive page?
- How do I move/order posts with a tag to the end?
- Use same slug base for Custom Post Type posts, and multiple taxonomy terms
- How do I display the taxonomy term alongside the post type post title?
- Filter CPT posts by one or more categories
- Getting categories of posts under a custom taxonomy
- How do I display the taxonomy for a custom post type in an array
- How to edit this code to get the categories in achieve page?
- Custom Post, set object Taxonomy terms in plugin
- Hierarchy and access control for Custom Post Types (CPT)
- How to include term custom meta into the custom taxonomy term permalink structure
- Best method to make posts searchable, sortable and filterable – custom field, tag or category?
- Lists custom taxonomy terms that has specific custom field value assigned to the term (not post)
- Display taxonomy terms, child terms and posts in a template
- Use custom walker to add taxonomy terms to main nav menu
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- Add term to custom post type on draft
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- How to get WordPress term attached to the Post?
- How to get only child terms from a custom taxonomy of current post type?
- How to add current custom taxonomy slug to body class
- Disable custom taxonomy on admin bar
- Display Custom Post Types Glossary
- Get the link of the first post of a custom taxonomy in a custom taxonomy list
- How should I structure complex content hierarchies?
- cannot achieve this structure (custom posts VS categories VS ??)
- Is it possible to have hierarchical taxonomy and hierarchical custom post types in one permalink?
- how to organize my categories or should I do custom post types for some?
- Multiple categories assigned to a single product breaking the breadcrumb
- How to divide Subcategories into pages of parent category wordpress
- Custom front-end form for adding post – Category problem
- display post count in archive page that have relation with another taxonomy term
- get taxonomies from terms
- Change the term based on the value of a $variable using wp_update_post in submitting a form
- Show Custom Post Type based on Category on Archive Page
- Get all posts for custom taxonomy term
- posts_per_page is not working by term
- Dropwdown: Get taxonomy terms from posts that share preselected terms from 3 other taxonomies
- CPT: multiple loops with different terms
- Custom category taxonomy – archive page not showing up
- Add active class to foundation 6 tabs while looping categories
- Filter By Term Not Working – Custom Post Type
- Custom post type category archive URL redirects to home page
- WordPress query posts by custom post type not workng
- Get posts of an specific term of a custom taxonomy
- WP_Query for CPT with filter by another WP_Query
- Organizing The Custom Post Type with Taxonomies / Parent Posts
- Display 2nd category, only once, as sub-heading, in the loop
- How to List CPTs Under One Tax Term
- Taxonomy Query of Custom Post Displays Archive Instead of Posts
- List custom taxonomy terms
- Remove slug from Custom Category Permalink + dual-category permalinks
- Display associated taxonomy child name on single CPT page
- Issue On Listing Woocommerce Parent Tag List
- Taxonomy Archive URL + Template