Created
June 25, 2015 23:46
-
-
Save Frithir/871f2a397c1479bdae43 to your computer and use it in GitHub Desktop.
Wordpress Custom post type results template.
This file contains 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
// Custom post type results template. | |
function template_chooser($template) { | |
global $wp_query; | |
$post_type = get_query_var('post_type'); | |
if( isset($_GET['s']) && $post_type == 'directory_list' ) { | |
return locate_template('archive-directory.php'); // redirect to archive-search.php | |
} | |
if( isset($_GET['s']) && $post_type == 'resource' ) { | |
return locate_template('archive-resources.php'); // redirect to archive-search.php | |
} | |
return $template; | |
} | |
add_filter('template_include', 'template_chooser'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment