質問編集履歴

4

大幅に追記しました。

2018/04/16 11:46

投稿

KaoriAbe
KaoriAbe

スコア10

test CHANGED
File without changes
test CHANGED
@@ -215,3 +215,75 @@
215
215
  もう一つグローバルナビがあるのですが、このページに限り表示されません。
216
216
 
217
217
  get_sidebar()問題ないはずなんですが・・・
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+ 後から気がついたのですが、カスタムメニューで作ったメニューがarchive.phpだけで表示されない
226
+
227
+ get_sidebar();はついております。
228
+
229
+ htmlで確認するとメニューのタグの部分がそっくりそのまま抜けていでおそらくPHP側で問題があるようです。
230
+
231
+ メニューを表示するにはどうしたらいいでしょうか?
232
+
233
+
234
+
235
+ 固定ページに以下のようにタグ機能をつけました。
236
+
237
+ ```ここに言語を入力
238
+
239
+ functions.php
240
+
241
+ // 固定ページにカテゴリーを設定
242
+
243
+ function add_categorie_to_pages(){
244
+
245
+ register_taxonomy_for_object_type('category', 'page');
246
+
247
+ }
248
+
249
+ add_action('init','add_categorie_to_pages');
250
+
251
+ // カテゴリーアーカイブに固定ページを含める
252
+
253
+ function add_page_to_category_archive( $query ) {
254
+
255
+ if ( $query->is_category== true && $query->is_main_query() ) {
256
+
257
+ $query->set('post_type', array( 'post', 'page' ));
258
+
259
+ }
260
+
261
+ }
262
+
263
+ add_action( 'pre_get_posts', 'add_page_to_category_archive' );
264
+
265
+ // 固定ページにタグを設定
266
+
267
+ function add_tag_to_page() {
268
+
269
+ register_taxonomy_for_object_type('post_tag', 'page');
270
+
271
+ }
272
+
273
+ add_action('init', 'add_tag_to_page');
274
+
275
+ // タグアーカイブに固定ページを含める
276
+
277
+ function add_page_to_tag_archive( $obj ) {
278
+
279
+ if ( is_tag() ) {
280
+
281
+ $obj->query_vars['post_type'] = array( 'post', 'page' );
282
+
283
+ }
284
+
285
+ }
286
+
287
+ add_action( 'pre_get_posts', 'add_page_to_tag_archive' );
288
+
289
+ ```

3

他のナビゲーションが全て表示されない事がわかりました。

2018/04/16 11:46

投稿

KaoriAbe
KaoriAbe

スコア10

test CHANGED
File without changes
test CHANGED
@@ -203,3 +203,15 @@
203
203
  テーマはこちらのテーマをカスタマイズしています。
204
204
 
205
205
  https://afterimagedesigns.com/wp-bootstrap-starter/
206
+
207
+
208
+
209
+
210
+
211
+ 追記
212
+
213
+ ナビゲーションが全て表示されない事がわかりました。
214
+
215
+ もう一つグローバルナビがあるのですが、このページに限り表示されません。
216
+
217
+ get_sidebar()問題ないはずなんですが・・・

2

content-page.php → template-parts/content.phpの内容に変更しました

2018/04/16 11:11

投稿

KaoriAbe
KaoriAbe

スコア10

test CHANGED
File without changes
test CHANGED
@@ -92,39 +92,63 @@
92
92
 
93
93
  ```ここに言語を入力
94
94
 
95
- content-page.php
95
+ template-parts/content.php
96
-
97
-
98
96
 
99
97
  <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
100
98
 
99
+ <div class="post-thumbnail">
100
+
101
+ <?php the_post_thumbnail(); ?>
102
+
103
+ </div>
104
+
105
+ <header class="entry-header">
106
+
101
- <?php
107
+ <?php
102
-
103
- $enable_vc = get_post_meta(get_the_ID(), '_wpb_vc_js_status', true);
108
+
104
-
105
- if(!$enable_vc ) {
109
+ if ( is_single() ) :
106
-
107
- ?>
110
+
108
-
109
- <header class="entry-header">
110
-
111
- <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
111
+ the_title( '<h1 class="entry-title">', '</h1>' );
112
+
113
+ else :
114
+
115
+ the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
116
+
117
+ endif;
118
+
119
+
120
+
121
+ if ( 'post' === get_post_type() ) : ?>
122
+
123
+ <div class="entry-meta">
124
+
125
+ <time datetime="<?php the_time('Y-m-d'); ?>"><?php the_time('Y.m.d'); ?></time>
126
+
127
+ <p><?php the_category(', '); ?></p>
128
+
129
+ </div><!-- .entry-meta -->
130
+
131
+ <?php
132
+
133
+ endif; ?>
112
134
 
113
135
  </header><!-- .entry-header -->
114
136
 
115
- <?php } ?>
116
-
117
137
  <div class="entry-content">
118
138
 
119
- <?php if (has_post_thumbnail()) : ?>
120
-
121
- <?php the_post_thumbnail(); ?>
122
-
123
- <?php endif; ?>
124
-
125
- <?php
139
+ <?php
140
+
126
-
141
+ if ( is_single() ) :
142
+
127
- the_content();
143
+ the_excerpt();
144
+
145
+ else :
146
+
147
+ the_excerpt( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'wp-bootstrap-starter' ) );
148
+
149
+ endif;
150
+
151
+
128
152
 
129
153
  wp_link_pages( array(
130
154
 
@@ -138,35 +162,7 @@
138
162
 
139
163
  </div><!-- .entry-content -->
140
164
 
141
- <?php if ( get_edit_post_link() && !$enable_vc ) : ?>
165
+
142
-
143
- <footer class="entry-footer">
144
-
145
- <?php
146
-
147
- edit_post_link(
148
-
149
- sprintf(
150
-
151
- /* translators: %s: Name of current post */
152
-
153
- esc_html__( 'Edit %s', 'wp-bootstrap-starter' ),
154
-
155
- the_title( '<span class="screen-reader-text">"', '"</span>', false )
156
-
157
- ),
158
-
159
- '<span class="edit-link">',
160
-
161
- '</span>'
162
-
163
- );
164
-
165
- ?>
166
-
167
- </footer><!-- .entry-footer -->
168
-
169
- <?php endif; ?>
170
166
 
171
167
  </article><!-- #post-## -->
172
168
 

1

テーマのリンクを追加しました。

2018/04/15 19:14

投稿

KaoriAbe
KaoriAbe

スコア10

test CHANGED
File without changes
test CHANGED
@@ -199,3 +199,11 @@
199
199
  ) );
200
200
 
201
201
  ```
202
+
203
+
204
+
205
+ 追記
206
+
207
+ テーマはこちらのテーマをカスタマイズしています。
208
+
209
+ https://afterimagedesigns.com/wp-bootstrap-starter/