wordpressのトップテージ(index.php))にヘッダーといくつかの固定ページを読み込ませたあとに続けて、下記のように記事を表示させるようにしたいと思っていますが記事が表示されません。
原因がわかる方がいらっしゃいましたらご教示いただけますでしょうか。
よろしくお願いいたします。
<div class="contents"> <?php if(is_category() || is_tag()): ?> <h1><?php single_cat_title() ?>の記事一覧</h1> <?php elseif(is_year()): ?> <h1><?php the_time("Y年") ?>の記事一覧</h1> <?php elseif(is_month()): ?> <h1><?php the_time("Y年m月") ?>の記事一覧</h1> <?php endif; ?> <!--ループ開始--> <?php if(have_posts()): while(have_posts()): the_post(); ?> <article <?php post_class( 'kiji-list' ); ?>> <a href="<?php the_permalink(); ?>"> <!--画像を追加--> <?php if( has_post_thumbnail() ): ?> <?php the_post_thumbnail('thumbnail'); ?> <?php else: ?> <img src="<?php echo get_template_directory_uri(); ?>/images/no-image.gif" alt="no-img"/> <?php endif; ?> <!--テキストエリア--> <div class="text"> <!--タイトル--> <h2> <?php the_title(); ?> </h2> <!--投稿日を表示--> <span class="kiji-date"> <!--<i class="fas fa-angle-right"></i>--> <time datetime="<?php echo get_the_date() ?>"> <?php echo get_the_date(); ?> </time> </span> <!--カテゴリ--> <?php if (!is_category()): ?> <?php if( has_category() ): ?> <span class="cat-data"> <?php $postcat=get_the_category(); echo $postcat[0]->name; ?> </span> <?php endif; ?> <?php endif; ?> <?php the_excerpt(); ?> </div> </a> </article> <?php endwhile; endif; ?><!--ループ終了-->
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。