Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
新着記事表示の例(get_posts)
<dl>
<?php $newslist = get_posts('numberposts=0&category=1,2');
//numberposts=0で全ての記事、0以外で記事件数設定。category=カテゴリIDで指定カテゴリのみ表示(カンマ区切り)
foreach( $newslist as $post ):
setup_postdata( $post );
?>
<dt> <?php the_time('Y年n月j日'); ?></dt>
<dd> <a href="<?php the_permalink(); ?>"> <?php the_title(); ?></a> </dd>
<?php endforeach; wp_reset_postdata(); ?>
</dl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment