0

For instance, I have a product post type and I would like all the taxonomies associated w/ this type, such as size, color, material etc to display using the same template without having to 1. create a catch all taxonomy.php that might interfere w/ taxonomies on other post types and 2. without having to manually create taxonomy-size.php, taxonomy-color.php, etc since new taxonomies can be created at any time.

can i do this by hijacking template redirect?

  • Please move your solution to an answer so this doesn't haunt site as unanswered. – Rarst Nov 10 '11 at 12:02
  • done. trying to go back and solve my unanswereds.... – helgatheviking Feb 17 '12 at 19:39
0

the answer is yes, yes i can. do love it when i find the answer w/in minutes of posting here.

add_action('template_redirect', 'my_template');

function my_template() {
    if ( is_tax() && in_array(get_query_var('taxonomy'), get_object_taxonomies('product') ) ){
        include (get_stylesheet_directory(). '/product_taxonomy.php');
        exit;   
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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