Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Yesterday some wonderful people helped me solve the issue here about templates for custom taxonomy terms.

Now I have a related question. Again, I have a custom post type set up in my functions.php called "Research"

I have a custom taxonomy called "Classifications"

Under that taxonomy I have the terms:

oldresearch (parent) --- subcat1 --- subcat2

I need all the single pages under this term "Old Research" and in the sub cats to use one template. I already have a single-research.php that is being use elsewhere. So that's not my preferred option. Any ideas? Please be detailed as I'm a PHP newb - sorry. lol Thanks in advance!

share|improve this question
add comment

1 Answer

While I haven't found a perfect solution yet, as I'd hoped to do some automated call for the template in the functions.php or template file, I have found a workaround.

I'm using the "custom post template" plugin. Out of the box this plug in does not support CPT's, however, you can place the code below in your functions.php file to make it work with CPT's.

/**
 * Hooks the WP cpt_post_types filter 
 *
 * @param array $post_types An array of post type names that the templates be used by
 * @return array The array of post type names that the templates be used by
 **/
function my_cpt_post_types( $post_types ) {
    $post_types[] = 'YOURPOSTTYPENAME1';
    $post_types[] = 'YOURPOSTTYPENAME2';
    return $post_types;
}
add_filter( 'cpt_post_types', 'my_cpt_post_types' );

On your post edit screen, select the post template you have created. http://wordpress.org/plugins/custom-post-template/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.