Assuming you want it for all the terms in the ‘Genre’ taxonomy. In the loop on the single Service post page, put this code:
<?php
$the_terms = get_the_terms( get_the_ID, 'genre' );
if(isset($the_terms) && !empty($the_terms)){
foreach($the_terms as $the_term){
$the_terms_slugs[] = $the_term->slug;
}
}
$works = get_posts(array(
'post_type' => 'works',
'posts_per_page' => 5,
'tax_query' => array(array(
'taxonomy' => 'genre',
'field' => 'slug',
'terms' => $the_terms_slugs
)));
//This will print the works which have the same genre as the current post
print_r($works_query);
?>
If you want it only for ‘novice’, let me know and I’ll modify the code.
Related Posts:
- How do I query a custom post type with a custom taxonomy?
- how to group custom post type posts by custom taxonomy terms
- Posts per Page on custom Taxonomy Template
- How to get the parent’s taxonomy?
- Query posts by custom post type and custom taxonomy
- How to get only one category of custom post type?
- pre get posts changing the query
- Query for posts in 2 taxonomies
- ‘category__and’ for custom taxonomy?
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- How to dynamically build a multiple taxonomy query loop within a post type’s single loop?
- List custom post type by custom tax term as page title
- how can i get posts from custom post type particular taxonomy category
- How to query custom post types posts filtered by multiple custom taxonomies through a form selection
- Query/list all terms and their custom post count
- Archive for custom taxonomy lists all posts instead of current taxonomy
- How to use custom taxonomies to reference complex relationships?
- Conditional Query of Custom Post Type and custom taxonomy
- Show a Category X’s custom post type on Category X archive page?
- How to edit this code to get the categories in achieve page?
- Listing all term items alphabetically / sorting loop
- How to display Related Posts based on number of taxonomy terms matched
- How to make WP_Query not to show irrelevant posts?
- Custom query – get_the_terms not work
- Control content before and after custom post type loop
- Custom post type, custom taxonomy, query posts only from taxonomy (children of)
- Display custom posts randomly in custom taxonomy archive
- Not able to export large no. of posts in csv
- attach CPT data to a taxonomy
- Targeting custom post type via functions.php doesn’t work
- List all posts in taxonomy term
- Query Multiple Custom Post Types & Exclude a Taxonomy Term
- Sorting the Loop by Taxonomy Value
- custom post type and a “sticky” position taxonomy
- Posts per Page on custom Taxonomy Template
- Getting Custom Posts with Custom Taxonomy
- WordPress custom post type
- Display 2nd category, only once, as sub-heading, in the loop
- Advanced Custom Fields: query posts filtered by multiple field values
- Inserting two categories
- How to get all taxonomies of a post type?
- Permalinks: custom post type -> custom taxonomy -> post
- How to Add Tags to Custom Post Type?
- Mixing custom post type and taxonomy rewrite structures?
- Can multiple custom post types share a custom taxonomy?
- How to Add Custom Fields to a Custom Post Type?
- Efficient Taxonomy Intersection
- Display current taxonomy term when inside custom post type
- limit selection of custom taxonomies to one?
- $wp_query->queried_object->ID throws warning: Undefined property
- Custom permalinks – post type – hierarchical taxonomy’s
- Taxonomy posts on Archive page
- Taxonomy list. Order by a specific custom post type count
- Rewrite CPT slug with two taxonomy slug instead of one
- Archive or taxonomy pages not working for custom post type
- Custom Taxonomy returns no posts
- Custom content type meta_box_cb does not run
- Custom Taxonomy breaking pages permalinks
- Custom query shows custom post types in trash
- Problem with custom post types, taxonomy and permalinks
- How to create new category for custom post type?
- Fetch taxonomies by custom post type id array
- Remove url rewrites for registered taxonomies
- Received nothing after executing AJAX post function
- How can I auto-assign a CPT post to category in a custom taxonomy when published?
- Mapping Subdomains in WordPress to give the appearance of a localised site, best approach?
- Display as tree terms of taxonomy and custom posts for each term of taxonomy
- Post count by month of taxonmy term
- Custom post type and custom taxonomy with the same slug using the file page taxonomy only as directory
- Pretty URL for custom search for custom post type
- First custom field value (out of several) displayed twice after query
- Custom while loop for hierarchical display of a taxonomy
- Migrating a taxonomy’s tags to the native category
- Grouping of CPTs and taxonomies into menu groups in admin
- WP_query – Filter by tax_query and meta_query using multiple select
- Hide meta box for everything BUT a certain custom post type
- Only show posts with a specific term of an associated taxonomy in a custom post type archive
- filter by custom taxonomy using ajax
- Display custom tags for custom post listing page
- Page listing all categories for CPT
- Grab all Custom Posts by multiple taxonomies and terms
- Custom Post Types and Complex Content Hierarchy
- If custom taxonomy else conditional [closed]
- Confusion about how to use Custom Post Types, Custom Taxonomy or Category?
- Displaying Posts Using a Custom Query with a Custom Field and a term_id
- How to display custom taxonomy term specific post?
- Get taxonomy name used in a current post
- Custom Taxonomy Archive generates 404
- Support for author does not show author column in post table in dashboard
- Force WordPress to only match URL in category
- 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?
- Custom Post Status & Taxonomies
- Show Custom Post Type taxonomy term that matches custom field
- How to Display Custom Taxonomies in an Un-ordered HTML List
- how do I create a breadcrumb to work with multiple custom taxonomies
- Custom taxonomy meta fields
- How to add categories to a custom post type using wp_insert_post($new_post);
- Modify permalink of CPT archive to support two taxonomies