WP_Queryによるサブループの基本の使い方 とりあえず、WP_Queryを用いたサブループの基本的な使い方から。いつもこれをコピペしてから引数をいじってます。 サブループの大枠となる雛形コード <?php //$argsのプロパティを変えていく $args = array( 'post_type' => 'post', 'posts_per_page' => -1, 'no_found_rows' => true, //ページャーを使う時はfalseに。 ); $the_query = new WP_Query($args); if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post(); /* ループ内の記述 */ endwhile; endif; wp_reset_
![いっつも忘れるWP_Queryの使用方法とパラメータ一覧。がっつり整理してみた | WEMO](https://cdn-ak-scissors.b.st-hatena.com/image/square/0b867e7f449cf402dac5060773ca1943a60aa1e9/height=288;version=1;width=512/https%3A%2F%2Fwemo.tech%2Fwp-content%2Fuploads%2F2017%2F06%2Fwpquery.jpg)