I’d use Custom Fields to achieve the effect. Have a custom field text area that takes the embedded video code and then on you’re single.php template you can modify it take the value of the Custom Field and embed the video.
Add a Custom Field widget and set it to Text Area. Disable preview and Append to Post Content. I gave it a title key of youtube. Then in single.php, I added this piece of code which displays the embedded code correctly:
<?php $youtube = get_post_meta(get_the_ID(),'youtube',true); if(!empty($youtube)) { ?>
<p><?php echo $youtube; ?></p>
<?php } ?>
Now the danger with this method is security, they can paste any sort of code. So what might be easier is to ask for the URL of the youtube video and in the singe.php, convert it to the embedded code and display it.
Or an even nicer way. Install the plugin Viper's Video QuickTags. Now configure the Custom Field to be a URL and modify the format to be "[youtube]%%VALUE%%[/youtube]" and make sure "Append Custom Field to Post Content" is checked. This won't work in preview, but if they supply a URL for youtube, Vipers video plugin will handle how to display it.
Hi all,
I would like to know how can I use viper’s video quicktags like you have explained it well, Mark, but with an option to select video platform : the user can select Youtube or Dailymotion, or other platform, and paste the video URL on a box, and TDO mini forms turns automatically the url into embed code (via vipers plugin) by taking the choice of the platform choosen by the user.
Is it possible ?
job78
Guest
May 12th, 2009 at 8:49 pm
Is there a way to permit embedded videos even if moderation is disabled ?
Thanks!
Permalink | Quote