サイドバーの最近のコメントの$post=・・・は必要ですか
-
お世話になります。
初心者なので教えていただければ幸いです。一般的にサイドバーに最近のコメントを表示するには、次のようなコードにするかと思います。
<ul><?php $comments = get_comments('type=comment&status=approve&number=5'); foreach($comments as $comment): $post = get_post($comment->comment_post_ID); ?> <li> <a href="<?php comments_link(); ?>"><?php echo mb_substr(get_comment_excerpt(), 0, 100); ?></a></li> <?php endforeach; ?> </ul>この中で、
$post = get_post($comment->comment_post_ID);
は必要なのでしょうか。
削っても動作するように感じるのです。
3件の返信を表示中 - 1 - 3件目 (全3件中)
3件の返信を表示中 - 1 - 3件目 (全3件中)
トピック「サイドバーの最近のコメントの$post=・・・は必要ですか」には新たに返信することはできません。