目次
functions.php
function enable_post_type_search_template($template){
if ( is_search() ) {
$post_types = get_query_var('post_type');
foreach ( (array) $post_types as $post_type )
$templates[] = "search-{$post_type}.php";
$templates[] = 'search.php';
$template = get_query_template('search',$templates);
}
return $template;
}
add_filter('template_include','enable_post_type_search_template');
コメント