gatespaceさん、申し訳ありません。
間違えて「テーマ」の方に投稿してしまったのですが、、削除の仕方が分かりません。
どのようにすればよいのでしょう…
このフォーラムではユーザーがトピックス(投稿)を削除することはできません。
必要無い方のトピックスに、継続する方のトピックスのURLを投稿した上で解決済みにしてください。
gatespaceさん、もうひとつのトピックスを解決済みにしました。ご迷惑おかけしました。
たぶんこんな感じ
// テンプレート読み込みフィルターをカスタマイズ
add_filter('template_include','custom_search_template');
function custom_search_template($template){
// 検索結果の時
if ( is_search() ) {
// 表示する投稿タイプを取得
$post_types = (array) get_query_var('post_type');
// 表示する投稿タイプに 'product' が存在していたら
if ( in_array('product',$post_types) ) {
// search-product.php を読み込む
$template = get_query_template('search-product');
}
}
return $template;
}
ちょっと調べてみたらこっちの方がよさそうでした。functions.phpに追記してもらえれば動きます
// テンプレート読み込みフィルターをカスタマイズ
add_filter('template_include','custom_search_template');
function custom_search_template($template){
// 検索結果の時
if ( is_search() ) {
// 表示する投稿タイプを取得
$post_types = get_query_var('post_type');
// search-{$post_type}.php の読み込みルールを追加
foreach ( (array) $post_types as $post_type )
$templates[] = "search-{$post_type}.php";
$templates[] = 'search.php';
$template = get_query_template('search',$templates);
}
return $template;
}
hissyさん、ありがとうございます!
完璧にやりたい事ができました。
感謝です!!
これから勉強していきたいと思います。
今後ともよろしくお願いします。