アーカイブのタイトル一覧表示「Custom Posts Per Page」


表示件数を変更できるプラグイン「Custom Posts Per Page」を使用してアーカイブのタイトル一覧表示。

記事の件数が多くなってきた。アーカイブを”タイトル一覧表示”にできるというhyperpupさんの記事を参考にカスタマイズ。

<ul>
<?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
<li id="catpost-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"> <?php the_title(); ?></a><?php the_date(''); ?> at <?php the_time() ?></li>
<?php endforeach; else: ?>
</ul>
<?php _e('Sorry, no posts matched your criteria.'); ?>
<?php endif; ?>

上記コードをarchive.phpに追記するとアーカイブのタイトル一覧表示になる。

表示件数を変更は・・

  1. プラグイン「Custom Posts Per Page」をダウンロード。
  2. ファイル名を「 perpage.php 」に変更。
  3. perpage.php内の下記部分の表示件数を変更
  4. wp-content/pluginsにアップロード⇒有効化


$posts_per['home'] = 4;
$posts_per['day'] = 10;
$posts_per['month'] = 10;
$posts_per['search'] = 10;
$posts_per['year'] = 999;
$posts_per['author'] = 999;
$posts_per['category'] = 999;

以上で”タイトル一覧表示”完了

関連記事

コメント»アーカイブのタイトル一覧表示「Custom Posts Per Page」

  1. [...] hyperpupさんちのカテゴリを選ぶとタイトルリストにと アーカイブのタイトル一覧表示「Custom Posts Per Page」を参考に。 [...]

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

*

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <img localsrc="" alt="">