WordPressでプラグインを使わずにカテゴリー別に記事を取得する方法と全ての記事を取得する方法をメモ。 WordPressでカテゴリー別に記事を取得する カテゴリー別に記事を取得する方法は以下のコードになります。 <ul> <?php $args = array( 'numberposts' => 'all','category' => 1, 'orderby' => 'desc'); $rand_posts = get_posts( $args ); foreach( $rand_posts as $post ) : ?> <li> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a> </li> <?php endforeach; ?> </ul> 最初
![Wordpressでカテゴリー別に記事を取得する方法](https://cdn-ak-scissors.b.st-hatena.com/image/square/19fb518615a5afdf643c21e121f78c07a88826d2/height=288;version=1;width=512/https%3A%2F%2Ftetra-themes.com%2Fwp-content%2Fuploads%2F2012%2F10%2F21shoshorov.jpeg)