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
- How to create new category for custom post type?
- How to check the terms in single custom post type template
- Displaying a custom post types custom taxonomy value?
- Insert HTML inside link in a walker
- get_the_terms return only last term
- Custom Post Types and independent Categories – complex Taxonomy
- Does WordPress limit the length of slug names for Post Meta or Terms?
- Should I use custom taxonomy or custom post type
- Set menu active state for custom posttype and category, given custom taxonomy term
- get_post_meta returns empty array for terms
- Group posts by custom post type
- Show listings from Impress Listing plugin in random order using taxonomy and terms
- Display all posts in main category and 1 subcategory
- Update post terms with custom taxonomy
- How do I display tags for a custom post type single page?
- How can I auto-assign a CPT post to category in a custom taxonomy when published?
- Filtering WP_Query Dynamically on the Front-End
- Get template part using a custom taxonomy term
- Get posts by querying taxonomy and certain terms of the taxonomy?
- How to restrict users and admin from creating new taxonomy terms?
- Posts from all the categories are being displayed instead of particular category
- Conditional Statement custom post type category
- Custom Post Type With Categories
- using $wpdb to get custom post type with term
- Categories sorting
- Show posts from two or more custom taxonomy terms
- get_category_parents for custom post type taxonomy
- Displaying custom taxonomy in the admin list of a custom post type
- wp_list_categories() – current-cat class also inside posts?
- Which post does a taxonomy term belongs to?
- Categories of custom taxonomy don’t show any posts
- How to display custom taxonomies with links in filter menu?
- A question on creating filters for custom posts using taxonomy
- Conditional Query of Custom Post Type and custom taxonomy
- List custom taxonomy specific to one custom post type
- 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?
- Display post as term id
- WordPress sort search results by custom order
- Cannot add category or custom taxonomy from admin. WordPress site is hosted in Windows 16 server via IIS. No XAMPP or WAMP
- 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?
- Limit amount of posts made within a custom taxonomy
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- Filter CPT posts by one or more categories
- Getting categories of posts under a custom taxonomy
- Post count by month of taxonmy term
- Can’t remove front from permalinks for custom taxonomy category page
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- How to start a new post with custom Taxonomies already set?
- 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?
- Display Custom Taxonomy Alphabetically
- How do I require the specification of term in a custom post type and custom taxonomy?
- 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
- Get terms that contain posts that in turn belong to other terms?
- Best method to make posts searchable, sortable and filterable – custom field, tag or category?
- Custom while loop for hierarchical display of a taxonomy
- Lists custom taxonomy terms that has specific custom field value assigned to the term (not post)
- How to add attributes to taxonomies that may be different from post to post?
- Display taxonomy terms, child terms and posts in a template
- Use custom walker to add taxonomy terms to main nav menu
- browse by category and tags?
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- Migrating a taxonomy’s tags to the native category
- Add term to custom post type on draft
- List of Posts and Categories
- Displaying custom-taxonomy-terms sorted by parent/child-hierarchy?
- Listing all term items alphabetically / sorting loop
- How to produce a sub-page-system in WordPress
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- How to get WordPress term attached to the Post?
- Query posts with double taxonomy
- Categorise Custom Post Types
- WP the_posts() on single-cars.php get category link
- Adding predefined terms to a taxonomy
- custom post type vs. conditionally displaying meta boxes for specific terms?