[Resolved] Show comments and comments form within a view?

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 5 replies, has 2 voices.

Last updated by Caridad 5 years, 2 months ago.

Assigned support staff: Caridad.

Author
Posts
#14627

Is it possible to show the comments and comments form within a View or View template? The only view shortcode I see is Comments Number.

#14710

Dear Gregg,

For this you should use the comments_template() function that is normally called from the template file (probably page.php or single.php). Your theme should already be calling this function.

Please let me know if there is anything else that I can assist you with.

Regards.
Caridad

#14712

I think it's a little more complicated. I'm actually using this specific View to display a number of returned posts. Can I insert a function into the view? In any case, the distinction is that I'm trying to insert the comments template into a post listing with multiple posts. Is that possible?

#14725

Dear Gregg,

You can always resort to creating your own shortcodes. Open the file functions.php in your theme and add these lines to it:

add_shortcode('wpv-post-comments', 'my_post_comments');
function my_post_comments() {
       ob_start();
       comments_template();
       $data = ob_get_clean();
       return $data;
}

Please let me know if there is anything else that I can assist you with.

Regards.
Caridad

#14969

Thanks Caridad!!! Works great.

#275673

Marking as resolved.