List Comments in get_posts Loop
-
Hello, I’m having trouble trying to list comments in a get_posts loop. The same comments are showing for all posts instead of the relevant comments to each post. I’m not finding much documentation for this specific loop after tons of searches. Hoping I’ve missed something simple. Any help is very appreciated!
$args = array ( 'post_type' => array( 'wod' ), 'order' => 'ASC', 'orderby' => 'menu_order', 'post_per_page' => 999 ); $wods = get_posts( $args ); ?> <?php foreach ( $wods as $wod ) : setup_postdata( $wod ); if ( comments_open($wod->ID) || get_comments_number($wod->ID) ) { comment_form(); global $wod, $wp_query; $comment_args = array( 'ID' => $wod->ID, 'status' => 'approve', 'order' => 'ASC' ); $wp_query->comments = get_comments( $comment_args ); ?> <ol class="comment-list"> <?php wp_list_comments($wod); ?> </ol>
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘List Comments in get_posts Loop’ is closed to new replies.