To loop through all the slugs of a term list, simply call get_the_terms()
and pull only the slugs:
$slugs = wp_list_pluck( get_the_terms( get_the_ID(), 'prodcat' ), 'slug' );
Then you need to check if you got any results:
if ( ! empty( $slugs ) )
The problem I then see arising is that you got a bunch of slugs in return (unless you restricted the admin meta box to allowing only a single term).
You’d then have to decide on some custom criteria which nav menu you want to have and pull that from the list of $slugs
:
// Decide which slug fits and then determine the key:
$key = 0;
get_template_part( 'nav', $slugs[ $key ] );
Related Posts:
- If on term-page -> get the current term?
- get_template_part for each level of taxonomy term
- Get template part using a custom taxonomy term
- Conditional Query of Custom Post Type and custom taxonomy
- How to check if post/page or taxonomy post is published by admin
- Showing taxonomy terms on custom post type
- Get template part with CPT and Custom Taxonomy conditionals
- Conditional Statements
- If custom taxonomy else conditional [closed]
- Shouldn’t this be easy?! Custom post type/custom taxonomy permalink
- How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy
- Combining Multiple Taxonomies in one URL
- How can I list all the categories under a Custom Post Type (taxonomy)?
- Two Custom Post Types, Share Two Taxonomies
- ‘No pages found’ in Dashboard after registering custom taxonomy
- Pages, Custom Posts & Custom Taxonomy defining slug structure
- How to rewrite custom post type URL for multiple depths instead of one specific depth
- How to show a tag archive of one post type only
- WP_Query on custom post type not displaying, multiple loops & get_template_part
- Conditional two level dropdown filter for custom post type
- Custom Taxonomy archive returns 404
- Custom edit post column – category not showing
- How to show multiple post types on taxonomy archive?
- Custom post type / custom fields
- using custom taxonomies on non wp table?
- WP 3.1 getting tax_query to work in query_posts()
- Custom Taxonomy Not Showing Up on Post Page
- Custom permalink – append taxonomy name and term name at the end of permalink
- Limit users by custom taxonomy and user roles
- WordPress Custom Post types and Taxonomy relationships best practices
- Custom Taxonomy Creates Unwanted Integer Terms on Post Save
- Display custom post type taxonomies as an archive page
- Custom Taxonomy Not Showing in Menu
- how to add extra meta box or textarea into custom post types
- Prevent custom taxonomy from being added to admin menu?
- Podcast Guest List
- WordPress Genesis custom taxonomy archive shows 3 repeats of each post
- Custom taxonomy in URL showing 404
- Update post terms with custom taxonomy
- Deleting Custom Taxonomy Term only increments tag_ID
- Get custom post type list for every category shortcode
- getting all values of a custom taxonomy if there is no post
- Listing tags from a custom post type
- How to duplicate entire custom post type
- How Can I Change the Custom Post Type Slug to the Taxonomy Slug in the URL?
- Use same slug base for Custom Post Type posts, and multiple taxonomy terms
- create a subcatagory for a custom post type and out put url as posttype/subcategory/item
- How do I display the taxonomy term alongside the post type post title?
- Custom Post, set object Taxonomy terms in plugin
- Hierarchy and access control for Custom Post Types (CPT)
- Custom post type permalink tag 404
- How to get list of taxonomy slugs ordered parents>childs?
- Custom post type / taxonomy rewrite archive page 2 gives 404
- Loop through custom posts by taxonomy and display the titles in a list, it is repeating 8 times
- Custom post type, custom taxonomy, query posts only from taxonomy (children of)
- Template for custom post type when taxonomy is in the URL
- Get parent category(taxonomy) ID from single template of a custom post type
- Dynamic CPT / Taxonomy
- How to approach a site where it has sub-businesses, each with its own pages (“articles”, “staff”)? Don’t want to use WP multisite
- Query custom post types & Taxonomies and list them in a table on a page
- How to query custom post type by two terms?
- Get the link of the first post of a custom taxonomy in a custom taxonomy list
- Get custom term meta problem on single post type
- Creating custom post type posts and associating them with a post from another custom post type
- Different structure/content for posts from a custom post type
- Redirect to URL if x number of days passed
- Custom Post Type URL Rewrite’s
- Add term for custom taxonomy from front end
- Custom Taxonomy Filter Issues
- how to organize my categories or should I do custom post types for some?
- How do i display post from a taxonomy term?
- Auto Generate Post Title from 2 Custom Fields
- How do I make a request in my browser to search the CPT taxonomy?
- Archive page of taxonomy returns a 404 error
- Custom post type template – add banner under heading
- Get dropdown child categories from parent category of custom post type
- How do you create pillar content pages?
- Custom post type single page returning 404 error when sharing archive url with custom taxonomy
- Shortcode and get_template_part
- I want to create a metabox under custom taxonomy
- Grid slider with custom post type (how to filter with taxonomies?)
- Set different posts_per_page for custom post type/taxonomy
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- Facing some Issues on Two Parts Custom Post Type Taxonomy Names
- I want to create an archive and single page for a custom taxonomy for a custom post type
- Creating adminable dynamic filtering on custom post type
- Complex strcuture as CPT or taxonomy for use in woocommerce product variations [closed]
- WP_Query for CPT with filter by another WP_Query
- Get posts in same category not working
- Heirarchical URLs with CPT and custom taxonomy
- Shortcode display CPT Query only showing 1 post?
- Permalinks when using Custom Post Type with static page for archive
- How to change permalinks to taxonomy and post type’s posts
- Get Registered Custom Post Type to get All Custom Taxonomies
- Re-using single CPT code with get_template_part?
- Parent cpt/child custom post type URL permalink relationship
- Query Only Show Text on Posts With Certain Taxonomy Tag
- How to make a single Menu Item call another Mega Menu for Custom Post Types and Custom Taxonomies?
- Display ONLY ONE $term (Out of 4 terms) from a Custom Taxonomy and CPT
- Create a hierarchical list of posts that’s grouped and nested by category