質問編集履歴
4
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,63 +14,63 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
-
|
17
|
+
<!-- 検索キーワードがないとき -->
|
18
18
|
|
19
|
-
|
19
|
+
<?php if ( empty( get_search_query() ) ); ?>
|
20
20
|
|
21
|
-
|
21
|
+
<?php get_template_part( 'template-parts/content', 'search-somosomonai' ); ?>
|
22
22
|
|
23
|
-
|
24
23
|
|
25
|
-
<!-- 検索キーワードがあるとき -->
|
26
24
|
|
27
|
-
|
25
|
+
<!-- 検索キーワードがあるとき -->
|
28
26
|
|
29
|
-
|
27
|
+
<?php else; ?>
|
30
28
|
|
31
|
-
<!-- 該当記事あり -->
|
32
29
|
|
33
|
-
<?php if ( have_posts() ); ?>
|
34
30
|
|
35
|
-
|
31
|
+
<!-- 該当記事あり -->
|
36
32
|
|
37
|
-
|
33
|
+
<?php if ( have_posts() ); ?>
|
38
34
|
|
39
|
-
|
35
|
+
<main id="primary" class="content-area" role="main">
|
40
36
|
|
41
|
-
|
37
|
+
<div id="posts">
|
42
38
|
|
43
|
-
|
39
|
+
<header class="header">
|
44
40
|
|
45
|
-
|
41
|
+
<h1 class="entry-title">
|
46
42
|
|
47
|
-
|
43
|
+
<?php printf( esc_html__( 'Search Results for: %s', 'dyad' ), '<span>' . get_search_query() . '</span>' ); ?>
|
48
44
|
|
49
|
-
|
45
|
+
</h1>
|
50
46
|
|
51
|
-
|
47
|
+
</header>
|
52
48
|
|
53
|
-
|
49
|
+
<?php while ( have_posts() ) : the_post(); ?>
|
54
50
|
|
55
|
-
|
51
|
+
<?php get_template_part( 'template-parts/content', 'search-aru' ); ?>
|
56
52
|
|
57
|
-
|
53
|
+
<?php endwhile; ?>
|
58
54
|
|
59
|
-
|
55
|
+
</div>
|
60
56
|
|
61
|
-
|
57
|
+
</main>
|
62
58
|
|
63
|
-
<?php else; ?>
|
64
59
|
|
65
|
-
<?php get_template_part( 'template-parts/content', 'search-nai' ); ?>
|
66
60
|
|
67
|
-
|
61
|
+
<!-- 該当記事なし -->
|
68
62
|
|
69
|
-
|
63
|
+
<?php else; ?>
|
70
64
|
|
71
|
-
|
65
|
+
<?php get_template_part( 'template-parts/content', 'search-nai' ); ?>
|
72
66
|
|
73
|
-
|
67
|
+
<?php endif; ?>
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
<?php endif; ?>
|
72
|
+
|
73
|
+
|
74
74
|
|
75
75
|
<?php get_footer(); ?>
|
76
76
|
|
3
タイトルの適正化
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
PHPエラーの確認と修正方法
|
test
CHANGED
File without changes
|
2
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
WordPressの検索結果ページの書き方を知りたくて質問させて頂きました。
|
2
2
|
|
3
|
-
なぜ次の書き方で画面が真っ白になるのか、わかりません。
|
3
|
+
なぜ次の書き方で画面が真っ白になるのか、わかりません。。
|
4
4
|
|
5
5
|
どなたか教えてくださいませ。
|
6
6
|
|
1
内容の簡略化
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
検索結果ページ
|
1
|
+
検索結果ページの書き方
|
test
CHANGED
@@ -1,22 +1,12 @@
|
|
1
|
-
WordPressの検索結果ページ
|
1
|
+
WordPressの検索結果ページの書き方を知りたくて質問させて頂きました。
|
2
|
+
|
3
|
+
なぜ次の書き方で画面が真っ白になるのか、わかりません。
|
4
|
+
|
5
|
+
どなたか教えてくださいませ。
|
2
6
|
|
3
7
|
|
4
8
|
|
5
|
-
以下に
|
6
|
-
|
7
|
-
・検索結果のテンプレート【search.php】と、
|
8
|
-
|
9
|
-
・検索結果ありのテンプレート【content-search-aru.php】を
|
10
|
-
|
11
|
-
記します。
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
###検索結果のテンプレート
|
16
|
-
|
17
|
-
次のように条件分岐をしていて、こちらはうまくいっています。
|
18
|
-
|
19
|
-
▼
|
9
|
+
▼search.php
|
20
10
|
|
21
11
|
```php
|
22
12
|
|
@@ -24,98 +14,64 @@
|
|
24
14
|
|
25
15
|
|
26
16
|
|
27
|
-
<
|
17
|
+
<!-- 検索キーワードがないとき -->
|
28
18
|
|
29
|
-
if ( empty( get_search_query() ) )
|
19
|
+
<?php if ( empty( get_search_query() ) ); ?>
|
30
20
|
|
31
|
-
/
|
21
|
+
<?php get_template_part( 'template-parts/content', 'search-somosomonai' ); ?>
|
32
22
|
|
33
|
-
|
23
|
+
|
34
24
|
|
35
|
-
|
25
|
+
<!-- 検索キーワードがあるとき -->
|
36
26
|
|
37
|
-
|
27
|
+
<?php else; ?>
|
38
28
|
|
39
|
-
|
29
|
+
|
40
30
|
|
41
|
-
|
31
|
+
<!-- 該当記事あり -->
|
42
32
|
|
43
|
-
|
33
|
+
<?php if ( have_posts() ); ?>
|
44
34
|
|
45
|
-
|
35
|
+
<main id="primary" class="content-area" role="main">
|
46
36
|
|
47
|
-
|
37
|
+
<div id="posts">
|
48
38
|
|
49
|
-
else
|
39
|
+
<header class="header">
|
50
40
|
|
51
|
-
|
41
|
+
<h1 class="entry-title">
|
52
42
|
|
53
|
-
|
43
|
+
<?php printf( esc_html__( 'Search Results for: %s', 'dyad' ), '<span>' . get_search_query() . '</span>' ); ?>
|
54
44
|
|
55
|
-
|
45
|
+
</h1>
|
56
46
|
|
47
|
+
</header>
|
48
|
+
|
49
|
+
<?php while ( have_posts() ) : the_post(); ?>
|
50
|
+
|
51
|
+
<?php get_template_part( 'template-parts/content', 'search-aru' ); ?>
|
52
|
+
|
53
|
+
<?php endwhile; ?>
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
</main>
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
<!-- 該当記事なし -->
|
62
|
+
|
63
|
+
<?php else; ?>
|
64
|
+
|
65
|
+
<?php get_template_part( 'template-parts/content', 'search-nai' ); ?>
|
66
|
+
|
57
|
-
endif; ?>
|
67
|
+
<?php endif; ?>
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
<?php endif; ?>
|
58
72
|
|
59
73
|
|
60
74
|
|
61
75
|
<?php get_footer(); ?>
|
62
76
|
|
63
77
|
```
|
64
|
-
|
65
|
-
###検索結果ありのテンプレート
|
66
|
-
|
67
|
-
この``<header class="header">この部分</header>``が繰り返し表示されてしまうのですが、次のコードは何がおかしいのでしょうか?
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
▼【content-search-aru.php】
|
72
|
-
|
73
|
-
```php
|
74
|
-
|
75
|
-
<main id="primary" class="content-area" role="main">
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
<div id="posts">
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
<header class="header">
|
84
|
-
|
85
|
-
<div class="entry-header">
|
86
|
-
|
87
|
-
<h1 class="entry-title">
|
88
|
-
|
89
|
-
<?php printf( esc_html__( 'Search Results for: %s', 'dyad' ), '<span>' . get_search_query() . '</span>' ); ?>
|
90
|
-
|
91
|
-
</h1>
|
92
|
-
|
93
|
-
</div>
|
94
|
-
|
95
|
-
</header>
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
100
|
-
|
101
|
-
<div class="entry-inner">
|
102
|
-
|
103
|
-
<?php get_template_part('template-parts/custom1'); ?>
|
104
|
-
|
105
|
-
</div>
|
106
|
-
|
107
|
-
</article>
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
</div><!-- #posts -->
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
</main><!-- #main -->
|
116
|
-
|
117
|
-
```
|
118
|
-
|
119
|
-
以上です。
|
120
|
-
|
121
|
-
宜しくお願い致します。
|