WordPress 特定のカテゴリーページを特定件数出したい
2010.12.04query_post
カテゴリ名「message」という記事の最新3件をリスト表示する場合
<?php query_posts('&posts_per_page=3&category_name=message&order=DESC'); ?><!-- DESCは一番新しい記事が上に表示される(逆はASC) -->
<?php if (have_posts()) : ?>
<h3>お知らせ</h3>
<ul>
<?php while (have_posts()) : the_post(); ?>
<li>
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'kubrick'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a><!-- タイトルをリスト表示 -->
</li>
<?php endwhile; endif; ?>
<?php wp_reset_query();?>
参考
関連
おすすめ
- カテゴリーページの時にURLに/categoryがついてしまう時の対処 - 0 views
- テキストリンクの色いろいろ - 0 views
- WordPressのSEO対策に…Google XML Sitemapsプラグイン - 0 views
- リンク切れに有効!Broken Link Checker - 0 views
- よけいなものは要らない!meta情報の編集 - 0 views