実現したいこと
固定ページでデフォルトの投稿一覧を表示したい
前提
WPでブログ機能を作っているのですが、ループ処理で投稿を表示しようとしても、固定ページの1つの投稿が表示されてしまう。
該当のソースコード
<?php /* Template Name: お知らせ */ ?> <?php get_header(); ?> <main> <section class="team"> <div class="team__head"> <h1 class="team__ttl ttl"> <em>NEWS</em>お知らせ </h1> </div> <div class="news__wrapper page"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="news__post"> <div class="news__date"><?php the_time('20y年n月j日') ?><br></div> <p class="news__post__ttl"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p> </div> <?php endwhile; endif; ?> </div> </section> </main> <?php get_footer(); ?>
試したこと
以下のコードを入れるとなぜかデフォルトの投稿記事が表示される
<?php query_posts('posts_per_page=3'); ?>
補足情報(FW/ツールのバージョンなど)

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。