ループ

メインループ

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <!-- ループ処理(例) -->
    <a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
<?php endwhile; endif; ?>
  • if (have_posts()): 記事が存在するかチェック
  • while (have_posts()): 記事がある間は、処理を繰り返す
  • the_post() 次の記事情報を取得する

サブループ

関数

WP_query()

フック


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-04-11 (月) 11:54:54 (744d)