wordpress 插入视频短代码 支持优酷,土豆,ku6,youtube
来源:互联网 发布:阅书软件 编辑:程序博客网 时间:2024/04/30 06:37
在wordpress中有很多种方法插入视频,当wp自带的插入视频又比较笨,当然也有一些插件像Wordpress Video Plugin,smart-video,这些插件用起来也很不 "听话",你说我首页要输出摘要的,你也播放视频,这就不靠谱了…..
所以就自己动手下,做了几个短代码,直接插入视频,支持幽哭网,土豆片网,kuSix,一直被墙的youtube,在浏览该文章时插入视频。
幽哭版:
/**
*短代码调用方式
*简单版:[youku code="XXX"]
*默认视频大小为480X400,可添加width,height属性改变视频大小
*自定义版:
*[youku code="XXX" width="100" height="100"]
*/
function play_youku($atts){
extract(shortcode_atts(array(
'code'=>'',
'width'=>'480',
'height'=>'400'
),$atts));
$flash = '$width.'" height="'.$height.'" type="application/x-shockwave-flash" data="http://player.youku.com/player.php/sid/'.$code.'/v.swf">';
if(is_single()){
return $flash ;
}
return '';
}
add_shortcode('youku', 'play_youku');
土豆片版:
/**
*短代码调用方式
*简单版:[tudou code="XXX"]
*自定义版:
*[tudou code="XXX" width="100" height="100"]
*/
function play_tudou($atts){
extract(shortcode_atts(array(
'code'=>'',
'width'=>'480',
'height'=>'400'
),$atts));
$flash = '$width.'" height="'.$height.'" type="application/x-shockwave-flash" data="http://www.tudou.com/v/'.$code.'/v.swf">';
if(is_single()){
return $flash ;
}
return '';
}
add_shortcode('tudou', 'play_tudou');
*短代码调用方式
*简单版:[tudou code="XXX"]
*自定义版:
*[tudou code="XXX" width="100" height="100"]
*/
function play_tudou($atts){
extract(shortcode_atts(array(
'code'=>'',
'width'=>'480',
'height'=>'400'
),$atts));
$flash = '$width.'" height="'.$height.'" type="application/x-shockwave-flash" data="http://www.tudou.com/v/'.$code.'/v.swf">';
if(is_single()){
return $flash ;
}
return '';
}
add_shortcode('tudou', 'play_tudou');
kuSix:
/**
*短代码调用方式
*简单版:[ku6 code="XXX"]
*自定义版:
*[ku6 code="XXX" width="100" height="100"]
*/
function play_ku6($atts){
extract(shortcode_atts(array(
'code'=>'',
'width'=>'480',
'height'=>'400'
),$atts));
$flash = '$width.'" height="'.$height.'" type="application/x-shockwave-flash" data="http://player.ku6.com/refer/'.$code.'/v.swf">';
if(is_single()){
return $flash ;
}
return '';
}
add_shortcode('ku6', 'play_ku6');
*短代码调用方式
*简单版:[ku6 code="XXX"]
*自定义版:
*[ku6 code="XXX" width="100" height="100"]
*/
function play_ku6($atts){
extract(shortcode_atts(array(
'code'=>'',
'width'=>'480',
'height'=>'400'
),$atts));
$flash = '$width.'" height="'.$height.'" type="application/x-shockwave-flash" data="http://player.ku6.com/refer/'.$code.'/v.swf">';
if(is_single()){
return $flash ;
}
return '';
}
add_shortcode('ku6', 'play_ku6');
youtube版:
/**
*短代码调用方式
*简单版:[youtube code="XXX"]
*自定义版:
*[youtube code="XXX" width="100" height="100"]
*/
function play_youtube($atts){
extract(shortcode_atts(array(
'code'=>'',
'width'=>'480',
'height'=>'400'
),$atts));
$flash = '$width.'" height="'.$height.'" type="application/x-shockwave-flash" data="http://www.youtube.com/v/'.$code.'&hl=en_US&fs=1&autoplay=1">';
if(is_single()){
return $flash ;
}
return '';
}
add_shortcode('youtube', 'play_youtube');
*短代码调用方式
*简单版:[youtube code="XXX"]
*自定义版:
*[youtube code="XXX" width="100" height="100"]
*/
function play_youtube($atts){
extract(shortcode_atts(array(
'code'=>'',
'width'=>'480',
'height'=>'400'
),$atts));
$flash = '$width.'" height="'.$height.'" type="application/x-shockwave-flash" data="http://www.youtube.com/v/'.$code.'&hl=en_US&fs=1&autoplay=1">';
if(is_single()){
return $flash ;
}
return '';
}
add_shortcode('youtube', 'play_youtube');
使用时可下载video.php,解压出video.php上传到主题文件夹,并在主题文件夹functions.php 添加以下语句
include_once('video.php');
来源:http://www.xbc.me/wordpress-shortcode-for-insert-video/
- wordpress 插入视频短代码 支持优酷,土豆,ku6,youtube
- 利用WordPress短代码插入无广告的优酷视频
- 使用you-get或youtube-dl下载优酷/土豆/爱奇艺高清视频,FFmpeg合并视频
- android 使用WebView 支持播放优酷视频,土豆视频
- ckeditor自定义视频插件支持优酷、土豆、腾讯视频
- 怎样复制百度文库,怎样下载优酷、土豆、酷六和youtube视频
- 最好的FLV视频下载器 维棠 (支持优酷视频下载、土豆视频下载等)
- ku6 优酷 土豆 56对比
- 插件27:插入YouTube视频
- 如何将土豆优酷视频插入到自己网站里
- PHP抓取视频缩略图类VedioUrlParser(支持优酷、土豆、酷六、56、乐视、搜狐)
- php获取视频信息,支持优酷土豆新浪腾讯等多家网站
- VideoUrlParser互联网视频地址分析工具,支持优酷、土豆等
- 使用 iframe 引用优酷和土豆和腾讯视频,支持 HTML5 手机 播放
- 使用 WordPress 的 Embed 功能快速插入优酷视频
- 使用 WordPress 的 Embed 功能快速插入优酷视频
- wp 播放优酷 土豆视频。
- ios UIWebView 播放优酷土豆视频
- Pledit 打开错误无法正常运行的解决办法
- memcached全面剖析–3.memcached的删除机制和发展方向
- 已经立冬了
- Wget 的使用 与 使用技巧
- The C Programming Language 笔记(3)
- wordpress 插入视频短代码 支持优酷,土豆,ku6,youtube
- 数组名与指针
- ASP.net的网站在IIS7.0中发布后运行报错---编译器错误消息: CS0016:
- 从一段小小的C语言程序说起(3)
- fork 机制辨析(转自cnblog)
- 二、关于数组、值类型、引用类型及其他
- 让PowerPoint转成Flash格式
- 从百年康健回来!
- android ListItem 焦点获取问题