Tutorial: How to Add Comments to MND Video Vault

If you use my plugin MND Video Vault to run a video site, you might want to allow your visitors to comment on the videos.

In this tutorial I will show you how to modify your theme in order to display a comment form and comments.

Step 1 – Open comments on MND Video Vault

First, we will open the comments function on the single video pages. Go to your theme’s folder and open to edit the file functions.php. Add the following code:

function mndvault_comments_open( $open, $post_id ) {
$post = get_post( $post_id );

if ( 'mndvault_video' == $post->post_type )
$open = true;
return $open;
}
add_filter( 'comments_open', 'mndvault_comments_open', 10, 2 );

Step 2 – Display comments on MND Video Vault

In order to make the comment form and comments appear, we need to edit the page.php file by adding the following code:

<?php if ( get_post_type() == 'mndvault_video' ) :
comments_template();
endif; ?>

Make sure to check the coding in the file single.php in order to match the place of the comments.

End Result

Comments to MND Video Vault

That’s it! Your video archive is now set to accept comments 🙂

Let me know below if you have any questions or concerns.

2 responses... add one

This didn’t work because I have single-video.php so that’s the file I had to edit instead of page.php. Maybe add something like that to the tutorial in case others have created a separate file? I’m glad I can get comments on the videos now, so thank you! 😀

Hi Courtney:

I’m trying to add the same coding, but I’m having issues putting it in. Those issues are the box is not showing up. Any help would be great.

Leave a Reply

Your email address will not be published. Required fields are marked *