質問編集履歴
2
試したこと追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -16,4 +16,36 @@
|
|
16
16
|
いただいたアドバイスから、固定ページに記事を表示するようにできればと思い、
|
17
17
|
固定ページのGutenbergエディタで「ウィッジェット」→「custom post type latest posts 」を選択してみましたが「No posts found with the current block settings」と出てきてしまいます。
|
18
18
|
記事は作成してますのであるはずなのですが。。
|
19
|
-
引き続き調べます。
|
19
|
+
引き続き調べます。
|
20
|
+
|
21
|
+
### 試したこと2
|
22
|
+
|
23
|
+
front-page.phpに以下を記入しましたが、本文は表示されませんでした。
|
24
|
+
```<?php
|
25
|
+
/* (ステップ1)データの取得 */
|
26
|
+
$query = new WP_Query(
|
27
|
+
array(
|
28
|
+
'post_type' =>'report',
|
29
|
+
'posts_per_page' =>1,
|
30
|
+
)
|
31
|
+
);
|
32
|
+
?>
|
33
|
+
<?php
|
34
|
+
/* (ステップ2)データの表示 */
|
35
|
+
if ( $query->have_posts() ) : ?>
|
36
|
+
<div>
|
37
|
+
<?php while ( $query->have_posts() ) : $query->the_post();?>
|
38
|
+
<p><a href="<?php the_permalink(); ?>">
|
39
|
+
<?php the_title(); ?></a></p>
|
40
|
+
<p><?php echo get_the_date(); ?></p>
|
41
|
+
<p><?php the_category(", "); ?></p>
|
42
|
+
<p><?php the_content(); ?></p>
|
43
|
+
<?php if ( has_post_thumbnail() ) : ?>
|
44
|
+
<p><?php the_post_thumbnail(); ?></p>
|
45
|
+
<?php endif; ?>
|
46
|
+
<hr />
|
47
|
+
<?php endwhile; ?>
|
48
|
+
</div>
|
49
|
+
<?php endif; wp_reset_postdata(); ?>
|
50
|
+
コード
|
51
|
+
```
|
1
追記修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -10,4 +10,10 @@
|
|
10
10
|
表示形式を「日付/カテゴリー/タイトル/内容」に設定しましたが、内容が表示されません。
|
11
11
|
|
12
12
|
調べても一覧表示のやり方はたくさん出てきますが、全文を表示するやり方はなかなか出てきません。
|
13
|
-
よろしくお願いいたします。
|
13
|
+
よろしくお願いいたします。
|
14
|
+
|
15
|
+
### 追記
|
16
|
+
いただいたアドバイスから、固定ページに記事を表示するようにできればと思い、
|
17
|
+
固定ページのGutenbergエディタで「ウィッジェット」→「custom post type latest posts 」を選択してみましたが「No posts found with the current block settings」と出てきてしまいます。
|
18
|
+
記事は作成してますのであるはずなのですが。。
|
19
|
+
引き続き調べます。
|