質問編集履歴

4

誤字

2018/04/02 00:14

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -14,63 +14,63 @@
14
14
 
15
15
 
16
16
 
17
- <!-- 検索キーワードがないとき -->
17
+ <!-- 検索キーワードがないとき -->
18
18
 
19
- <?php if ( empty( get_search_query() ) ); ?>
19
+ <?php if ( empty( get_search_query() ) ); ?>
20
20
 
21
- <?php get_template_part( 'template-parts/content', 'search-somosomonai' ); ?>
21
+ <?php get_template_part( 'template-parts/content', 'search-somosomonai' ); ?>
22
22
 
23
-
24
23
 
25
- <!-- 検索キーワードがあるとき -->
26
24
 
27
- <?php else; ?>
25
+ <!-- 検索キーワードがあるとき -->
28
26
 
29
-
27
+ <?php else; ?>
30
28
 
31
- <!-- 該当記事あり -->
32
29
 
33
- <?php if ( have_posts() ); ?>
34
30
 
35
- <main id="primary" class="content-area" role="main">
31
+ <!-- 該当記事あり -->
36
32
 
37
- <div id="posts">
33
+ <?php if ( have_posts() ); ?>
38
34
 
39
- <header class="header">
35
+ <main id="primary" class="content-area" role="main">
40
36
 
41
- <h1 class="entry-title">
37
+ <div id="posts">
42
38
 
43
- <?php printf( esc_html__( 'Search Results for: %s', 'dyad' ), '<span>' . get_search_query() . '</span>' ); ?>
39
+ <header class="header">
44
40
 
45
- </h1>
41
+ <h1 class="entry-title">
46
42
 
47
- </header>
43
+ <?php printf( esc_html__( 'Search Results for: %s', 'dyad' ), '<span>' . get_search_query() . '</span>' ); ?>
48
44
 
49
- <?php while ( have_posts() ) : the_post(); ?>
45
+ </h1>
50
46
 
51
- <?php get_template_part( 'template-parts/content', 'search-aru' ); ?>
47
+ </header>
52
48
 
53
- <?php endwhile; ?>
49
+ <?php while ( have_posts() ) : the_post(); ?>
54
50
 
55
- </div>
51
+ <?php get_template_part( 'template-parts/content', 'search-aru' ); ?>
56
52
 
57
- </main>
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
- <?php endif; ?>
61
+ <!-- 該当記事なし -->
68
62
 
69
-
63
+ <?php else; ?>
70
64
 
71
- <?php endif; ?>
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

タイトルの適正化

2018/04/02 00:14

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- 検索結果ペ書き
1
+ PHPエラーの確認と修正
test CHANGED
File without changes

2

誤字

2018/04/01 16:01

投稿

退会済みユーザー
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

内容の簡略化

2018/04/01 15:47

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- 検索結果ページでヘッダーが繰り返されてしまう
1
+ 検索結果ページの書き方
test CHANGED
@@ -1,22 +1,12 @@
1
- WordPressの検索結果ページで``<header class="header">こ部分</header>``が繰てしまいますなぜでしょうか?
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
- search.php
9
+ ▼search.php
20
10
 
21
11
  ```php
22
12
 
@@ -24,98 +14,64 @@
24
14
 
25
15
 
26
16
 
27
- <?php
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
- get_template_part( 'template-parts/content', 'search-somosomonai' );
23
+
34
24
 
35
- else :
25
+ <!-- 検索キーワードがあるとき -->
36
26
 
37
- // 検索キーワードがあるとき
27
+ <?php else; ?>
38
28
 
39
- if ( have_posts() ) :
29
+
40
30
 
41
- // 該当するエントリーがるとき
31
+ <!-- 該当記事り -->
42
32
 
43
- while ( have_posts() ) : the_post();
33
+ <?php if ( have_posts() ); ?>
44
34
 
45
- get_template_part( 'template-parts/content', 'search-aru' );
35
+ <main id="primary" class="content-area" role="main">
46
36
 
47
- endwhile;
37
+ <div id="posts">
48
38
 
49
- else :
39
+ <header class="header">
50
40
 
51
- // 該当するエントリーがないとき
41
+ <h1 class="entry-title">
52
42
 
53
- get_template_part( 'template-parts/content', 'search-nai' );
43
+ <?php printf( esc_html__( 'Search Results for: %s', 'dyad' ), '<span>' . get_search_query() . '</span>' ); ?>
54
44
 
55
- endif;
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
- 宜しくお願い致します。