Created
September 15, 2011 03:08
-
-
Save zanematthew/1218426 to your computer and use it in GitHub Desktop.
Template Redirect loopy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach( $this->post_type as $wtf ) { | |
$my_cpt = get_post_types( array( 'name' => $wtf['type']), 'objects' ); | |
if ( is_tax( $wtf['taxonomies'] ) ) { | |
global $wp_query; | |
if ( in_array( $wp_query->query_vars['taxonomy'], $wtf['taxonomies'] ) ) { | |
if ( file_exists( MY_PLUGIN_DIR . 'theme/custom/' . $wtf['type'] . '-taxonomy.php' ) ) { | |
load_template( MY_PLUGIN_DIR . 'theme/custom/' . $wtf['type'] . '-taxonomy.php' ); | |
} elseif ( file_exists( MY_PLUGIN_DIR . 'theme/default/taxonomy.php' ) ) { | |
load_template( MY_PLUGIN_DIR . 'theme/default/taxonomy.php' ); | |
} elseif ( file_exists( STYLESHEETPATH . '/archive.php' ) ) { | |
load_template( STYLESHEETPATH . '/archive.php' ); | |
} else { | |
load_template( STYLESHEETPATH . '/index.php' ); | |
} | |
} else { | |
wp_die( 'Sorry the following taxonomies: ' . print_r( $wtf['taxonomies'] ) . ' are not in my array' ); | |
} | |
exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Correction, just noticed the variable $my_cpt is set but not used inside of the foreach.