Check this code:
<?php
$custom_terms = wp_get_post_terms($post->ID, 'service_tax');
$count = count($custom_terms);
if ( $count > 0 ) {
foreach($custom_terms as $custom_term) {
$args = array('post_type' => 'services_cpt',
'tax_query' => array(
array(
'taxonomy' => 'service_tax',
'field' => 'slug',
'terms' => $custom_term
),
),
);
$loop = new WP_Query($args);
if($loop->have_posts()) {
echo '<div class="col-md-4">';
echo '<a class="item-box" href="'.get_permalink().'">'.get_the_title().'</a>';
echo '</div>';
while($loop->have_posts()) : $loop->the_post();
endwhile;
}
}
}
?>
Related Posts:
- How to Add Custom Taxonomy To Woocommerce Plugin
- How to completely disable a taxonomy archive on the frontend?
- register_taxonomy with multiple object type and update_count_callback
- Custom Taxonomy and tax_query Issue?
- How to List Thumbnails based on Custom Categories
- Custom Taxonomy Not Showing in Menu
- Set object terms not working on plugin activation
- need advice on how to do a lists using custom post types – taxonomy vs postmeta
- How to Get Current Custom Post Type Selected Taxonomy Term (Not All Terms)
- get_object_taxonomies() returns empty array for custom post type
- Adding a custom post type taxonomy template in plugin
- How to add a custom taxonomy to show up in a custom post type menu?
- What is the best practice for displaying my plugin content in themes?
- Deleting taxonomy terms and relationships on a custom post_type when a user is deleted
- Plugin fatal error
- Custom post type’s extra fields – how to handle?
- Main query not querying any posts in custom taxonomy template
- How to add and clear custom post types and taxonomies in a plugin? Considerations for existing data
- Dynamically insert code to custom post type loop
- Show current custom taxonomy
- How to List Custom Post Type Titles Based on Theirs Taxonomy Terms Inside a Nested Loop
- Most viewed post of custom post type
- Writing a custom Glossary plugin
- Custom post type page with parameter
- Custom post type category link redirecting to 404 page
- Change Dropdown jQuery to show/hide but with default place holder that shows all
- How to show Custom Post Types under Taxonomy in a new WordPress page template?
- Why are custom taxonomies only appearing on the edit page of one of these types, but not the other?
- Error 404 change permalink term custom term taxonomy
- How can i display a taxonomy? i have created a plugin and then a custom type. and a taxonomy , also i have register it
- Changing CPT permalink
- I have a random letter appearing before my content. Where to start looking for the cause?
- Permalinks: custom post type -> custom taxonomy -> custom sub taxonomy -> post
- How to Use A Custom Post Type as Taxonomy for Another Custom Post Type
- Insert custom taxonomy into category query
- % encoded URL giving 404 error in WordPress
- Which File Populating CPTs in Slug URL
- Facing some Issues on Two Parts Custom Post Type Taxonomy Names
- Associate custom categories to different user IDs
- Organizing The Custom Post Type with Taxonomies / Parent Posts
- Render custom taxonomy query as single template
- Custom Taxonomy Showing in WP Menu
- Get term_id for each instance of custom taxonomy
- How to internationalize the sub menu name “categories” in Custom post type?
- Issue on Adding Taxonomy to Custom Post Type Using Function
- Custom Post Type urls not working
- How to filter custom post data with AJAX?
- Make term slugs of custom taxonomy available in WP REST API for custom post type?
- How to get all taxonomies of a post type?
- Permalinks: custom post type -> custom taxonomy -> post
- How to Add Tags to Custom Post Type?
- Efficient Taxonomy Intersection
- Set relationship between custom_post_types
- Custom taxonomy query for a custom post type
- Extend walker class with custom post types [closed]
- Is flush_rewrite_rules necessary when creating a custom post type? Why?
- Custom permalinks – post type – hierarchical taxonomy’s
- Taxonomy list. Order by a specific custom post type count
- Rewrite CPT slug with two taxonomy slug instead of one
- Custom content type meta_box_cb does not run
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- Custom Taxonomy breaking pages permalinks
- Get categories and descriptions from custom post type
- Problem with custom post types, taxonomy and permalinks
- How to create new category for custom post type?
- Repeating posts when paginating random posts
- Remove url rewrites for registered taxonomies
- Received nothing after executing AJAX post function
- Group CPT posts by custom taxonomy
- Metabox not show in categories custom post type cmb2
- Categorize custom post type
- Load Custom_post_type categories post with ajax
- Custom Permalink Structure for Custom Post Type, Custom Taxonomy, Under a page
- Why is my WP_Query outputting my entries twice?
- How to display Related Posts based on number of taxonomy terms matched
- How to solve this custom post type goes to 404 page?
- Get term name without a foreach loop
- How to Set Taxonomy Object Description?
- WP_Query() with custom post type and taxonomy — get all terms?
- get_terms() parent, child and grandchild
- Getting custom taxonomy posts on archive page
- Multi Parameter search with custom post type category and tag
- Can I set the post_type query_var as a link is clicked?
- Remove cpt slug from url and use custom taxonomy instead breaks all other cpt
- How to fix 404 on post after prepending Custom Post Type url with Custom Taxonomy Term slug
- Custom post type structure + permalink structure
- WP_Query based on ‘s’ and tax_queries
- How to structure a website with custom post types and custom taxonomies?
- Custom post type category link + add to menu
- The most recent post of custom taxonomy
- php output of generated custom metabox
- Force WordPress to only match URL in category
- Hierarchical taxonomy in permalink structure
- Can I create a taxonomy term that mirrors the name of a new custom post?
- Rewrite for custom type and custom taxonomy
- How to create TEMPLATES for TAXONOMIES? What I have to change in this code?
- Sort custom post type items by taxonomy description
- Get custom post type parent category
- Same slug for Custom Taxonomy archive and CPT archive – Rewrite rule not working
- Problem with shortcode