wpwordpressでプラグインやウィジェットを使わずコメント一覧を表示
2013/09/05
<ul><?php
$comments = get_comments(array('status' => 'approve', 'number' => 10));
foreach($comments as $comment):
$post = get_post($comment->comment_post_ID);
?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>へのコメント
(<?php comment_author_link(); ?>より[<?php comment_date('m/d'); ?>])
<?php comment_text(); ?></li>
<?php endforeach; ?></ul>
下記の部分の数字で表示件数を変更できます。(この場合は10件をリスト表示)'number' => 10));
Related Posts関連記事
- 2014/11/06WordPressでページ送り先のtitle重複をなくすタグ
- 2014/06/17カスタムフィールドの有無で条件分岐
- 2014/05/22カスタムフィールドの値をループ外で出力する
- 2014/05/09WordPressの自動マイナーアップデートを解除する
- 2014/02/28wordpressで固定ページの内容を出力する
- 2013/12/22wordpressでバナーなどの画像をランダム表示
- 2013/12/20wordpressでパーマリンクを変更した際の301リダイレクト
- 2013/12/13WordPressでサイトを作る際必ず使用するタグ一覧
- 2013/11/21WordPressをカスタマイズする際に必要な条件分岐
