| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

Adding video commenting to WordPress

Page history last edited by jay.dedman@... 12 years, 6 months ago

UPDATE: David Meade made a plugin that specifcially is built to add video comments to your blog. See here:

http://www.davidmeade.com/wordpress-plugins#videoComments

 

_______________________________________________________________

 

 

This is a step by step HOW-TO guide for adding the ability into WordPress (WP) to allow people to add URL's to videos that will play (embeded) in the comments. This is also known as video commenting. It goes without saying that in order to use these instructions, you need Admin access to the WP installation and FTP access to install the suggested plugin. It also must be noted that you need to have vPIP installed. This is required because it allows the videos to play embeded.

 

Download and install the WP plugin located here:

http://www.ideashower.com/our_solutions/wordpress-plugin-extra-comment-fields/

 

Note that you should install it in the "wp-content/plugins" root folder. Do not install it in a subfolder of plugins. It won't work.

 

In your WP Admin panel, go to Options>Extra Comment Field. In the variable field enter videolink and click on Add Field. Do this again and create a videothumb and a urlpostpermalink variable. Basically, we just created three extra variables that we will use in the comments. You should now have three variables listed. One called videolink, one called videothumb and one called urlpostpermalink.

 

You now need to edit your comments.php file. This is located most likely in: (/wp-content/themes/YOURTHEME/comments.php). You can edit this file in your editor of choice or you can edit it right within WP if you go to your WP Admin panel Presentation>Theme Editor.

 

We will add two text fields that will allow users to specify a URL that points to the video file and a URL that points to a thumbnail file which will be used to represent the video. To make this easy, we will just locate the existing field that allows the user to enter their website URL and just add our fields below that. Everyone has their own theme so it's hard to make a general guide on this, however the existing field should look something like this:

 

<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />

<label for="url"><strong><?php _e('Website','k2_domain'); ?></strong></label></p>

 

Below that, we will add our new fields. I have bolded the key differences like this:

 

 

<p><input type="text" name="videolink" id="url" value="" size="22" tabindex="4" />

<label for="url"><small><strong><?php _e('URL to Video File','k2_domain'); ?></strong></small></label></p>

<p><input type="text" name="videothumb" id="url" value="" size="22" tabindex="5" />

<label for="url"><small><strong><?php _e('URL to Video Thumbnail File','k2_domain'); ?></strong></small></label></p>

<p><input type="text" name="urlpostpermalink" id="url" value="" size="22" tabindex="6" />

<label for="url"><small><strong><?php _e('URL to original post','k2_domain'); ?></strong></small></label></p>

 

 

We will now add the code that is used to recall the field data when generating the page. The easiest place to put this is right after the author name and link. Locate the following line in your comments.php file:

 

<span class="commentauthor"><?php comment_author_link(); ?>

 

Below that add:

 

 

<?php if ($comment->extra_videolink != '') : ?>

<?php echo "<br />";?>

<?php echo "<br />";?>

<p><a href="/<?php print $comment->extra_videolink; ?>"><img src="<?php print $comment->extra_videothumb; ?>" title="Click to Play Video" alt="Click to Play Video" width="300"/></a></p>

<?php endif; ?>

 

(Note that if you have other plugins or hacks that modify the comments.php file then the above code may not work. Try it first, then (and only then) if it doesn't work, try the code below):

 

<?php global $wpdb; global $cextra;  $cextra=$wpdb->get_results("SELECT * FROM wp_comments_extra WHERE comment_id='$c->comment_ID'"); /* print "var (cextra[0]->videolink): ".$cextra[0]->videolink; */ ?>

<?php if ($cextra[0]->videolink!='') : ?>

<p><br /></p><p><a href="/<?php print $cextra[0]->videolink; ?>"><img src="<?php print $cextra[0]->videothumb; ?>" title="Click to Play Video" alt="Click to Play Video" width="300"/></a><br />permalink: <a href="/<?php print $cextra[0]->urlpostpermalink ?>"><?php print $cextra[0]->urlpostpermalink ?></a></p><p><br /></p>

<?php endif; ?>

Comments (0)

You don't have permission to comment on this page.