WPdiscuz does not work inside WP Query
-
I have a use case where I want to include a page/post with comments onto same page as another page/post. I have closed the comments for the main page/post but have comments open for the additional page/post. The comments and comment form load as required (using WP_Query() and comments_template()) but WPdiscuz does not take over here.
If I turn on comments for the main page/post, both comment sections (main and secondary) do have WPdiscuz in use. I want to have the possibility to have comments closed for the main loop but open for the second query.
//$discussion_id is the page id of the page I want to include $args = array( 'page_id' => $discussion_id, ); $discussion = new WP_Query( $args ); if ( $discussion->have_posts() ) : while ( $discussion->have_posts() ) : $discussion->the_post(); //displays the content get_template_part( 'partials/content', 'discussion' ); // this same code works w/o problem with the main loop if ( comments_open() || get_comments_number() ) : comments_template(); endif; endwhile; endif; wp_reset_postdata();
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘WPdiscuz does not work inside WP Query’ is closed to new replies.