Last active
November 8, 2019 09:48
-
-
Save jaredatch/3764391 to your computer and use it in GitHub Desktop.
Redirect taxonomy to use archive template
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
<?php | |
/** | |
* Redirect taxonomy to use custom post type archive template | |
* | |
* @author Jared Atchison | |
* @link http://jaredatchison.com/code/ | |
* @param string $template | |
* @return string | |
*/ | |
function ja_template_redirect( $template ) { | |
if ( is_tax( 'code-snippet-tag' ) ) { | |
$template = get_query_template( 'archive-code-snippet' ); | |
} | |
return $template; | |
} | |
add_filter( 'template_include', 'ja_template_redirect' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
8 years ago and works like a charm!