質問編集履歴
3
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
|
5
|
+
wordpressを利用しています。
|
6
6
|
|
7
7
|
エラーメッセージとしては、ラジオボタンで検索するとサイト内でのnothing found forがタイトルで出てきます。
|
8
8
|
|
@@ -26,7 +26,7 @@
|
|
26
26
|
|
27
27
|
|
28
28
|
|
29
|
-
page.php
|
29
|
+
固定ページ page.php
|
30
30
|
|
31
31
|
```
|
32
32
|
|
@@ -42,13 +42,13 @@
|
|
42
42
|
|
43
43
|
<ul>
|
44
44
|
|
45
|
+
<li><input id="shinsa-1" type="radio" name="st" value="st1" checked="checked" ><label for="shinsa-1">指定なし</label></li>
|
46
|
+
|
45
|
-
<li><
|
47
|
+
<li><input id="shinsa-2" type="radio" name="st" value="st2"><label for="shinsa-2">1時間以内</label></li>
|
46
|
-
|
47
|
-
|
48
|
+
|
48
|
-
|
49
|
-
<li><
|
49
|
+
<li><input id="shinsa-3" type="radio" name="st" value="st3"><label for="shinsa-3">当日中</label></li>
|
50
|
-
|
50
|
+
|
51
|
-
<li><
|
51
|
+
<li><input id="shinsa-4" type="radio" name="st" value="st4"><label for="shinsa-4">翌日以降</label></li>
|
52
52
|
|
53
53
|
</ul>
|
54
54
|
|
@@ -62,7 +62,7 @@
|
|
62
62
|
|
63
63
|
```
|
64
64
|
|
65
|
-
search.php
|
65
|
+
検索結果ページ search.php
|
66
66
|
|
67
67
|
```
|
68
68
|
|
@@ -82,11 +82,9 @@
|
|
82
82
|
|
83
83
|
$s = $_GET['s'];
|
84
84
|
|
85
|
-
$st =
|
85
|
+
$st = $_GET['st'];
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
86
|
+
|
87
|
+
|
90
88
|
|
91
89
|
//meta_query用
|
92
90
|
|
@@ -106,7 +104,7 @@
|
|
106
104
|
|
107
105
|
?>
|
108
106
|
|
109
|
-
|
107
|
+
<?php if($st){ ?>カスタムフィールド:<?php echo $st; } ?>
|
110
108
|
|
111
109
|
<?php
|
112
110
|
|
@@ -130,9 +128,7 @@
|
|
130
128
|
|
131
129
|
<?php if(is_search()){ ?>
|
132
130
|
|
133
|
-
|
131
|
+
|
134
|
-
|
135
|
-
<?php } ?>
|
136
132
|
|
137
133
|
|
138
134
|
|
@@ -222,26 +218,6 @@
|
|
222
218
|
|
223
219
|
<!--△メインコンテンツ-->
|
224
220
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
<?php if ((!is_front_page() and the_keni('view_sub') == "y") or (is_front_page() and the_keni('view_top_sub') == "y")) : ?>
|
230
|
-
|
231
|
-
<!--▽サブコンテンツ-->
|
232
|
-
|
233
|
-
<?php include (TEMPLATEPATH . "/sub-contents.php"); ?>
|
234
|
-
|
235
|
-
<!--△サブコンテンツ-->
|
236
|
-
|
237
|
-
<?php endif ?>
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
</div>
|
242
|
-
|
243
|
-
<!--△メイン&サブ-->
|
244
|
-
|
245
221
|
```
|
246
222
|
|
247
223
|
|
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
プラグインとしてAll in One SEOを利用しているので、それによると404ページという事になります。
|
10
10
|
|
11
|
-
URLもhttp://○○○.com/<?st
|
11
|
+
URLもhttp://○○○.com/<?st=△△などと出てきます。
|
12
12
|
|
13
13
|
通常は<の部分は=になると思うのですが。
|
14
14
|
|
@@ -42,13 +42,13 @@
|
|
42
42
|
|
43
43
|
<ul>
|
44
44
|
|
45
|
-
<li><label for="shinsa-1"><input id="shinsa-1" type="radio" name="st[]" value="
|
45
|
+
<li><label for="shinsa-1"><input id="shinsa-1" type="radio" name="st[]" value="st1" checked="checked" >指定なし</label></li>
|
46
|
-
|
46
|
+
|
47
|
-
<li><label for="shinsa-2"><input id="shinsa-2" type="radio" name="st[]" value="
|
47
|
+
<li><label for="shinsa-2"><input id="shinsa-2" type="radio" name="st[]" value="st2">1時間</label></li>
|
48
|
-
|
48
|
+
|
49
|
-
<li><label for="shinsa-3"><input id="shinsa-3" type="radio" name="st[]" value="
|
49
|
+
<li><label for="shinsa-3"><input id="shinsa-3" type="radio" name="st[]" value="st3">当日中</label></li>
|
50
|
-
|
50
|
+
|
51
|
-
<li><label for="shinsa-4"><input id="shinsa-4" type="radio" name="st[]" value="
|
51
|
+
<li><label for="shinsa-4"><input id="shinsa-4" type="radio" name="st[]" value="st4">翌日以降</label></li>
|
52
52
|
|
53
53
|
</ul>
|
54
54
|
|
@@ -82,7 +82,9 @@
|
|
82
82
|
|
83
83
|
$s = $_GET['s'];
|
84
84
|
|
85
|
-
$st =
|
85
|
+
$st = array('st1','st2','st3','st4');
|
86
|
+
|
87
|
+
|
86
88
|
|
87
89
|
|
88
90
|
|
1
書式の改善を致しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,20 +1,28 @@
|
|
1
|
-
|
1
|
+
PHPを利用して、ラジオボタン・チェックボックスの絞り込み検索を実現しようと思っていますが、上手く働いてくれません。
|
2
|
-
|
2
|
+
|
3
|
+
|
4
|
+
|
3
|
-
|
5
|
+
現在利用している物は、wordpressとテンプレート賢威です。
|
6
|
+
|
4
|
-
|
7
|
+
エラーメッセージとしては、ラジオボタンで検索するとサイト内でのnothing found forがタイトルで出てきます。
|
8
|
+
|
9
|
+
プラグインとしてAll in One SEOを利用しているので、それによると404ページという事になります。
|
10
|
+
|
11
|
+
URLもhttp://○○○.com/<?st%5B%5D=△△などと出てきます。
|
12
|
+
|
13
|
+
通常は<の部分は=になると思うのですが。
|
14
|
+
|
15
|
+
|
16
|
+
|
5
|
-
ラジオボタン
|
17
|
+
ラジオボタンの検索はカスタムフィールドを利用しています。
|
6
|
-
|
18
|
+
|
7
|
-
|
19
|
+
プラグインは「Custom Field Template」になります。
|
8
|
-
|
9
|
-
|
20
|
+
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
21
|
+
|
14
|
-
|
15
|
-
|
16
|
-
|
22
|
+
|
17
|
-
検索
|
23
|
+
通常のキーワード検索ではエラーは発生せず、キーワード通りの検索画面が出てきます。
|
24
|
+
|
25
|
+
URLもhttp://○○○.com/=?s=△△と綺麗に出てきます。
|
18
26
|
|
19
27
|
|
20
28
|
|
@@ -36,13 +44,11 @@
|
|
36
44
|
|
37
45
|
<li><label for="shinsa-1"><input id="shinsa-1" type="radio" name="st[]" value="指定なし" checked="checked" >指定なし</label></li>
|
38
46
|
|
39
|
-
<li><label for="shinsa-2"><input id="shinsa-2" type="radio" name="st[]" value="30分">30分</label></li>
|
40
|
-
|
41
|
-
<li><label for="shinsa-
|
47
|
+
<li><label for="shinsa-2"><input id="shinsa-2" type="radio" name="st[]" value="1時間">1時間</label></li>
|
42
|
-
|
48
|
+
|
43
|
-
<li><label for="shinsa-
|
49
|
+
<li><label for="shinsa-3"><input id="shinsa-3" type="radio" name="st[]" value="当日中">当日中</label></li>
|
44
|
-
|
50
|
+
|
45
|
-
<li><label for="shinsa-
|
51
|
+
<li><label for="shinsa-4"><input id="shinsa-4" type="radio" name="st[]" value="翌日移行">当日中</label></li>
|
46
52
|
|
47
53
|
</ul>
|
48
54
|
|
@@ -56,41 +62,43 @@
|
|
56
62
|
|
57
63
|
```
|
58
64
|
|
59
|
-
|
60
|
-
|
61
65
|
search.php
|
62
66
|
|
63
67
|
```
|
64
68
|
|
65
|
-
<!--main-->
|
66
|
-
|
67
|
-
<div id="main">
|
68
|
-
|
69
|
-
<!--
|
69
|
+
<!--▽メイン&サブ-->
|
70
|
-
|
70
|
+
|
71
|
-
<div id="main-
|
71
|
+
<div id="main-and-sub">
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
<!--▽メインコンテンツ-->
|
76
|
+
|
77
|
+
<div id="main-contents">
|
78
|
+
|
79
|
+
|
72
80
|
|
73
81
|
<?php
|
74
82
|
|
75
|
-
if (!is_front_page()) {
|
76
|
-
|
77
|
-
if(is_search() || (is_home()) or get_query_var('paged') > 1) { ?>
|
78
|
-
|
79
|
-
<!--▼パン屑ナビ-->
|
80
|
-
|
81
|
-
<div id="breadcrumbs">
|
82
|
-
|
83
|
-
<ol>
|
84
|
-
|
85
|
-
|
83
|
+
$s = $_GET['s'];
|
86
|
-
|
84
|
+
|
87
|
-
|
85
|
+
$st = $_GET['st'];
|
88
|
-
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
-
|
89
|
+
//meta_query用
|
90
|
+
|
90
|
-
|
91
|
+
if($st){
|
92
|
+
|
93
|
+
$metaquerysp[] = array(
|
94
|
+
|
95
|
+
'key'=>'st',
|
96
|
+
|
91
|
-
|
97
|
+
'value'=> $st,
|
92
|
-
|
98
|
+
|
93
|
-
|
99
|
+
'post_type'=>'page',
|
100
|
+
|
101
|
+
);
|
94
102
|
|
95
103
|
}
|
96
104
|
|
@@ -98,68 +106,42 @@
|
|
98
106
|
|
99
107
|
|
100
108
|
|
101
|
-
|
102
|
-
|
103
|
-
<!--▽メイン&サブ-->
|
104
|
-
|
105
|
-
<div id="main-and-sub">
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
<!--▽メインコンテンツ-->
|
110
|
-
|
111
|
-
<div id="main-contents">
|
112
|
-
|
113
|
-
|
114
|
-
|
115
109
|
<?php
|
116
110
|
|
117
|
-
$s = $_GET['s'];
|
118
|
-
|
119
|
-
$st = $_GET['st'];
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
//meta_query用
|
124
|
-
|
125
|
-
if($st){
|
126
|
-
|
127
|
-
|
111
|
+
query_posts( array(
|
128
|
-
|
112
|
+
|
129
|
-
|
113
|
+
'meta_query' => $metaquerysp,
|
130
|
-
|
114
|
+
|
131
|
-
|
115
|
+
's' => $s,
|
132
|
-
|
116
|
+
|
133
|
-
|
117
|
+
)
|
134
|
-
|
118
|
+
|
135
|
-
|
119
|
+
);
|
136
|
-
|
137
|
-
}
|
138
120
|
|
139
121
|
?>
|
140
122
|
|
141
123
|
|
142
124
|
|
143
|
-
<?php
|
144
|
-
|
145
|
-
query_posts( array(
|
146
|
-
|
147
|
-
'meta_query' => $metaquerysp,
|
148
|
-
|
149
|
-
's' => $s,
|
150
|
-
|
151
|
-
)
|
152
|
-
|
153
|
-
);
|
154
|
-
|
155
|
-
?>
|
156
|
-
|
157
|
-
|
158
|
-
|
159
125
|
<?php if (have_posts()) : ?>
|
160
126
|
|
161
127
|
|
162
128
|
|
129
|
+
<?php if(is_search()){ ?>
|
130
|
+
|
131
|
+
<p class="archive-title"><?php echo sprintf( __('Search Result for %s','keni'), get_search_query()).show_page_number(); ?></p>
|
132
|
+
|
133
|
+
<?php } ?>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
<?php while (have_posts()) : the_post(); ?>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
<div class="post">
|
144
|
+
|
163
145
|
<h2><?php the_title(); ?></h2>
|
164
146
|
|
165
147
|
|
@@ -182,19 +164,15 @@
|
|
182
164
|
|
183
165
|
<!--/article-->
|
184
166
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
167
|
+
|
190
|
-
|
191
|
-
|
168
|
+
|
192
|
-
|
169
|
+
|
170
|
+
|
193
|
-
<
|
171
|
+
</div>
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
198
176
|
|
199
177
|
|
200
178
|
|
@@ -262,32 +240,8 @@
|
|
262
240
|
|
263
241
|
<!--△メイン&サブ-->
|
264
242
|
|
265
|
-
|
266
|
-
|
267
|
-
```
|
243
|
+
```
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
244
|
+
|
272
|
-
|
273
|
-
|
245
|
+
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
246
|
+
|
278
|
-
|
279
|
-
通常検索したら△△△.com/?s=○○となると思うんですが、
|
280
|
-
|
281
|
-
|
247
|
+
参考にさせていただいているサイトは、http://kotori-blog.com/wordpress/refinement_search/となります。
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
キーワード検索では<は入ってこないです。
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
最終的にはラジオボタンで4項目ほど、チェックボックスで1項目に広げて絞り込み検索したいです。
|
290
|
-
|
291
|
-
よろしくお願いします。
|
292
|
-
|
293
|
-
説明が下手ですみません。
|