質問編集履歴
2
search-hoge.phpの中身について追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -48,6 +48,62 @@
|
|
48
48
|
|
49
49
|
---
|
50
50
|
|
51
|
+
|
52
|
+
|
51
53
|
追記
|
52
54
|
|
53
55
|
is_search()を利用すれば適用されるのですがsearch.phpには適用させたくないので利用できませんでした。
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
---
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
追記2
|
64
|
+
|
65
|
+
searchform2.phpは固定ページfuga(page-fuga.php)に
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
```php
|
70
|
+
|
71
|
+
<?php get_template_part( 'searchform2' ); ?>
|
72
|
+
|
73
|
+
```
|
74
|
+
|
75
|
+
を記述して表示させています。
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
functions.phpに
|
80
|
+
|
81
|
+
```php
|
82
|
+
|
83
|
+
function custom_search_template($template){
|
84
|
+
|
85
|
+
if ( is_search() ){
|
86
|
+
|
87
|
+
$post_types = get_query_var('post_type');
|
88
|
+
|
89
|
+
foreach ( (array) $post_types as $post_type )
|
90
|
+
|
91
|
+
$templates[] = "search-{$post_type}.php";
|
92
|
+
|
93
|
+
$templates[] = 'search.php';
|
94
|
+
|
95
|
+
$template = get_query_template('search',$templates);
|
96
|
+
|
97
|
+
}
|
98
|
+
|
99
|
+
return $template;
|
100
|
+
|
101
|
+
}
|
102
|
+
|
103
|
+
```
|
104
|
+
|
105
|
+
以上を記述してsearch-hoge.phpを表示させています。
|
106
|
+
|
107
|
+
search-hoge.phpの中身は固定ページfuga(page-fuga.php)にプラスして
|
108
|
+
|
109
|
+
searchform2の検索結果を表示させています。
|
1
試したこと
test
CHANGED
File without changes
|
test
CHANGED
@@ -43,3 +43,11 @@
|
|
43
43
|
固定ページfugaとpiyoカテゴリアーカイブには読みこまれています。
|
44
44
|
|
45
45
|
どのように記述すれば適用されるでしょうか。
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
---
|
50
|
+
|
51
|
+
追記
|
52
|
+
|
53
|
+
is_search()を利用すれば適用されるのですがsearch.phpには適用させたくないので利用できませんでした。
|