ページ機能を搭載したコメントプラグイン

ブログでたくさんのコメントが付いたとき、ページが縦に長くなって見づらいケースがあると思います。紹介するプラグインは、コメントを件数で区切り、ページ機能を持たせることでページを短く、見やすくするというものです。Ajaxを使用しているので、画面の切り替えがスムースなのが特徴。 YAAPC デモページはコチラ YAAPCのページからダウンロード。設置方法は通常のプラグインと変わりません。 設置後、管理画面で設定を行い、コメントを表示しているテンプレートファイルに命令を追加します。
  • コメントを<div id=”yaapc-comments”>として囲み
  • <?php yaapc_pages()?>を2カ所記述
以下、作者サイトのソースを転載しています。
<div id="yaapc-comments">
<?php if ($comments) : ?>
	<h3 id="comments"><?php the_title();</h3>
	<?php yaapc_pages()?>
	<ol   class="commentlist">
	<?php foreach ($comments as $comment) : ?>
	... ...
	<?php endforeach; /* end for each comment */ ?>
	</ol>
	<?php yaapc_pages()?>
 <?php else : // this is displayed if there are no comments so far ?>
	<?php if ('open' == $post->comment_status) : ?>
		<!-- If comments are open, but there are no comments. -->
	 <?php else : // comments are closed ?>
		<!-- If comments are closed. -->
		<p class="nocomments">Comments are closed.</p>
	<?php endif; ?>
<?php endif; ?>
</div>
英語版なので分かりづらいところあるかと思いますが、コメント機能を有効に使いたいユーザには重宝しそうです。

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

CAPTCHA


*