1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<?php $arg = array( 'posts_per_page' => 10, // 表示する件数 'orderby' => 'date', // 日付ソート 'order' => 'DESC', // DESCで降順、ASCで昇順 'category_name' => 'wp-customize' // カテゴリーのスラッグを指定 ); $posts = get_posts( $arg ); if( $posts ): ?> <ul> <?php foreach ( $posts as $post ) : setup_postdata( $post ); ?> <li><?php the_time( 'Y.m.d' ); ?><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul> <?php endif; wp_reset_postdata(); ?> |