0

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!

1 Answer 1

0

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/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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