1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
$args = [ 'status' => 'approve', 'orderby' => 'comment_date_gmt', 'order' => 'DESC', 'type' => 'comment', ];
$comments_query = new WP_Comment_Query; $comments = $comments_query->query( $args ); if ( $comments ) {
$get_comments_args = [ 'reverse_top_level' => false, 'reverse_children' => '', 'type' => 'comment', 'max_depth' => 3, 'per_page' => $number, 'callback' => 'my_comment_callback', ];
wp_list_comments($get_comments_args, $comments ); } else { echo 'コメントなし'; }
function my_comment_callback() { ?> <span>投稿者: </span><?php echo $comment->comment_author; ?> <?php comment_text( $comment->comment_id ); ?>
$default_settings = array( 'add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'), 'login_text' => __('Log in to Reply'), 'depth' => 3, 'before' => '', 'after' => '', 'max_depth' => get_option('thread_comments_depth'), ); comment_reply_link($default_settings, get_comment_ID(), $comment->comment_post_ID);
<a href="<?php echo get_permalink($comment->comment_post_ID); ?>">このコメントの投稿へ</a> <?php> } ?>
|