質問編集履歴

4

内容簡略化

2022/07/07 05:30

投稿

m718
m718

スコア2

test CHANGED
File without changes
test CHANGED
@@ -38,18 +38,6 @@
38
38
  $〇〇〇[] = htmlspecialchars($value, ENT_QUOTES);
39
39
  }
40
40
  $tax_query_args[] =
41
- array(
42
- 'taxonomy' => '〇〇〇',
43
- 'terms' => $〇〇〇,
44
- 'field' => 'term_id',
45
- 'operator' => 'IN'
46
- );
47
- }
48
- if (!empty($_POST['〇〇〇'])) {
49
- foreach ($_POST['〇〇〇'] as $value) {
50
- $〇〇〇[] = htmlspecialchars($value, ENT_QUOTES);
51
- }
52
- $tax_query_args[] =
53
41
  array(
54
42
  'taxonomy' => '〇〇〇',
55
43
  'terms' => $〇〇〇,
@@ -58,7 +46,7 @@
58
46
  );
59
47
  }
60
48
 
61
- if(!empty($_POST['search_craft']) || !empty($_POST['〇〇〇'])|| !empty($_POST['〇〇〇'])) {
49
+ if(!empty($_POST['search_craft']) || !empty($_POST['〇〇〇'])) {
62
50
  $args += array('tax_query' => array($tax_query_args));
63
51
  }
64
52
  ?>
@@ -72,7 +60,7 @@
72
60
  <div class="condition">
73
61
  <?php
74
62
  $〇〇〇 = get_terms('〇〇〇', array('hide_empty' => false));
75
- foreach ($〇〇〇s as $f〇〇〇t) :
63
+ foreach ($〇〇〇s as $〇〇〇) :
76
64
  $checked = "";
77
65
  if (in_array($〇〇〇->term_id, (array)$search_〇〇〇)) $checked = " checked";
78
66
  ?>
@@ -82,21 +70,6 @@
82
70
  </label>
83
71
  <?php endforeach; ?>
84
72
  </div>
85
-
86
-        <!--<div class="condition-title">職業別</div>
87
- <div class="condition">
88
- <?php
89
- $crafts = get_terms('craft', array('hide_empty' => false));
90
- foreach ($crafts as $craft) :
91
- $checked = "";
92
- if (in_array($craft->term_id, (array)$search_craft)) $checked = " checked";
93
- ?>
94
- <label>
95
- <input type="checkbox" name="search_craft[]" class="check_box" id="check_<?php echo esc_attr($craft->term_id); ?>" value="<?php echo esc_attr($craft->term_id); ?>" <?php echo $checked; ?>>
96
- <span><?php echo esc_html($craft->name); ?></span>
97
- </label>
98
- <?php endforeach; ?>
99
-        </div>-->
100
73
  <input type="submit" value="検索" class="submit-button" name="s" >
101
74
  <input type="hidden" name="search" value="1">
102
75
  <input type="hidden" name="s" value="<?php the_search_query(); ?>">

3

リンク切れ修正

2022/07/07 01:21

投稿

m718
m718

スコア2

test CHANGED
File without changes
test CHANGED
@@ -1,5 +1,5 @@
1
- [https://www.cg-method.com/side-job/wordpress-custom-search/](url)
1
+ [https://www.cg-method.com/side-job/wordpress-custom-search/](https://www.cg-method.com/side-job/wordpress-custom-search/)
2
- [https://webfun-style.com/wordpress-custom-search/](url)
2
+ [https://webfun-style.com/wordpress-custom-search/](https://webfun-style.com/wordpress-custom-search/)
3
3
 
4
4
  上記サイトを参考にカテゴリなどから絞り込み検索の作成をしています。
5
5
  こちらの方法ですと、作成したものの直下に検索結果が表示されます。

2

誤字

2022/07/06 05:17

投稿

m718
m718

スコア2

test CHANGED
File without changes
test CHANGED
@@ -4,11 +4,11 @@
4
4
  上記サイトを参考にカテゴリなどから絞り込み検索の作成をしています。
5
5
  こちらの方法ですと、作成したものの直下に検索結果が表示されます。
6
6
  ここまでは表示や検索などは動作しています。
7
- こちらの検索フォームをサイドバーに設置したいため、「seach.php」にて、メイン画面に結果の表示をさせたいです。
7
+ こちらの検索フォームをサイドバーに設置したいため、「search.php」にて、メイン画面に結果の表示をさせたいです。
8
8
  単純に結果の部分を「search.php」に貼るだけではなく、クリックイベントで呼び出す必要性があると思うのですが、その方法がわかりません。
9
9
 
10
10
  HTMLとCSSしか知識がないため理解が乏しくて申し訳ございません。
11
- ご教授、ご鞭撻の程よろしくお願いいたします。
11
+ よろしくお願いいたします。
12
12
 
13
13
  【custom-search.phpに記載している内容(一部ブランクあり)】
14
14
  ```PHP

1

誤字

2022/07/06 03:23

投稿

m718
m718

スコア2

test CHANGED
File without changes
test CHANGED
@@ -58,7 +58,7 @@
58
58
  );
59
59
  }
60
60
 
61
- if(!empty($_POST['search_craft']) || !empty($_POST['〇〇〇'])|| !empty($_POST['〇〇〇])) {
61
+ if(!empty($_POST['search_craft']) || !empty($_POST['〇〇〇'])|| !empty($_POST['〇〇〇'])) {
62
62
  $args += array('tax_query' => array($tax_query_args));
63
63
  }
64
64
  ?>