时间:2014-01-26所属栏目: WordPress教程 来源: 热度:
通常里在 WordPress 中插入视频险些都是行使土豆、优酷提供的视频代码,若想简化一下这个进程,可以修改 functions.php 并操作 swf 标签直接插入flash文件地点。
因为网上视频尺寸大都为 480×360 以是这里默以为宽 480px 高 360px ,打开模板里的 functions.php 拷入下面代码:
// Flash PLayer
function swf_player($atts, $content = null) {
extract(shortcode_atts(array("width"=>'480',"height"=>'360'),$atts));
return '<embed type="application/x-shockwave-flash" width="'.$width.'" height="'.$height.'" src="'.$content.'"></embed>';
}
add_shortcode('swf','swf_player');
尔后,在必要插入flash时,只需在编辑器里编写 [swf] 标签即可,如需变动尺寸,加上 width 和 height 即可,如下:
[swf width="640" height="480"]Flash url[/swf]