Well one approach would be to create a generic single-media.php
file and put a condition inside it which checks for the specific taxonomy. Then you would be able to include the other two based on the condition.
So, create the main template – single-media.php
and the other two templates page-media.php
and page-music-library.php
. Then you could check for the the specific
taxonomy in this file and include the corresponding file based on the condition.
a simple example of single-media.php
would be
<?php
/*
Template Name: Single Media
Template Post Type: post, media
*/
//header and stuff
if ( has_term( $term, $taxonomy, $post ) ) {
include '{path}/page-music-library.php';
else {
include '{path}/page-media.php' ;
}
Related Posts:
- What is singular.php?
- Custom Post Type Specific Post Template
- WordPress giving me the index
- Custom post type single-{custom}.php not working
- Conditional for single-{post-type}.php
- Page Template as Custom Post Type Archive
- Add Content to Page without shortcodes
- Pre get posts for single post
- Pull Two Posts Into Custom Post Type `single-cpt.php`
- is_singular() not working if called via callback function of admin-ajax.php
- Assign Page Template Within A Custom Post Type
- Custom post type archive and single.php files not working
- Page Templates – this code only works for one Custom Post Type
- Create sub single pages
- Using previous_post_link and next_post_link to wrap around post sequence
- Custom Post Type – Archive page title
- How do I create new content pages for my Custom Post Type?
- WordPress custom post type Single.php?
- How do I create a custom post type for a training CMS in WordPress?
- Post Rank on Single Post page based on custom field
- Displaying Meta Box Image
- Custom template for post type not working
- Custom Post Type slug same as page name causing a conflict
- Control Custom Post Type template from a plugin
- Detect if 1st, 2nd or 3rd level custom page?
- Create second custom 404 page for selected post type
- Hyphens instead of Underscores in Post-type Archive Template Filenames when Post-type handle contains underscore
- Help with CPT template pagination
- Can I make WordPress use a custom template for a child page
- Need to display same custom post type on 2 different singles templates
- How to call custom single post?
- Custom post template for particular posts
- Create Template for Custom Post Type same like for Page
- How to load a template without it being assigned to a page/post?
- Custom template with CPT doesn’t display on frontend
- Remove single page for custom post type
- Single Template that can be applied only via URL
- create a template page for a post
- Custom post type archive page template
- Custom Post Type with Templates using Meta Boxes?
- Posts are duplicating on wp_post_update
- Custom page sidebar using Template dropdown box
- custom post type parsed as attachment
- Programmatically rewriting slug through functions.php but returns 404
- How to render a custom post type template with custom fields using shortcode
- next_/previous_post_link() `in_same_category` appears to fail when true
- WordPress Custom Search by post_type
- Single page not working for custom post type
- Custom post type pages return 404 page?
- Get term name without a foreach loop
- Cant get paginations on single.php to work with my custom post types
- Including all post id’s of a custom post type into an array
- Display custom post types in wp_list_pages
- Include php on a specific page template
- Page Template Dropdown For Custom Post Types
- providing access to post_id or post inside functions.php
- How to get the current category with custom posts
- adding custom post type “name” to single template
- How to add page under a custom post type?
- trying to show single post but displays all post on a custom post type
- Enabling permalinks disables custom page template
- Custom Post Type Template Insert not working properply
- Loop and add Specific Categories and Products Images
- custom post template ignored after altering permalinks
- How can I allow users to edit text that will be displayed on a custom post type archive page?
- Display ONE taxonomy and its assigned pages
- Loop all post on single.php
- Modify Custom Post Type Slug
- WordPress Page hierarchy ( parent is singular of custom post types slug ) is returning not found
- How can I create a button that when clicked populates a div with a list of foods that are checked as a certain type of ACF?
- Custom post type not pulling CSS
- get_the_terms child terms for current post/custom post only
- Showing Custom Post Type with his templates on a custom page template
- Displaying posts inside table having issues
- custom post type single page
- custom post type single post preview for pending status
- How to show data content from single page which is from custom post type?
- How to get adjacent_post custom_field value
- Single Page of Custom Post Type Not Showing the Content Of post
- Show index and not the archive for “Dog Custom Post” with default slug
- DIVs not showing correctly on CPT?
- Display Taxonomy Term for CPT on single-CPT.php
- How to Fix Custom WordPress Loop with Pagination on Single Post View?
- custom fields not showing before get_header
- Custom Post Type Pagination Not Working or Single Posts Displaying?
- Templates list in “Page Attributes” metabox is inaccurate
- Custom post type single display is ommited
- Query child posts on parents single.php?
- Modifying and Displaying URL’s in a Post Template using parse_url
- Multiple search template with separate stylesheets
- Using custom post types within a section of a template
- How to make a list of posts displaying them 5 by 5 with a “next posts” link?
- is_singular won’t call my functions?
- Dynamically change Custom Post Type Template OR Change Permalink?
- Page templates for custom post types
- using a template for more then 1 page
- Adding custom theme template to custom post type [duplicate]
- Can I have a specific template for products even if they are standard posts and not CPT?
- display related posts based on the PAGE TITLE
- WordPress Multisite Network Shared Custom Post from Main Site using single-CPT.php