首先下载ckplayer,讲压缩包内主要的ckplayer文件夹放在WordPress站点根目录;
讲一下代码添加的WordPress主题的functions.php文件中:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | add_shortcode("ckplayer","ipc_ckplayer"); function ipc_ckplayer( $atts, $content=null ) { return " <div id="a1"></div> <script type="text/javascript" src="/ckplayer/ckplayer.js" charset="utf-8"></script> <script type="text/javascript"> var flashvars={ f:'".$content."', c:0, my_url:encodeURIComponent(window.location.href), my_title:encodeURIComponent(document.title) }; var params={bgcolor:'#FFF',allowFullScreen:true,allowScriptAccess:'always',wmode:'transparent'}; var video=['".$content."->video/mp4']; CKobject.embed('/ckplayer/ckplayer.swf','a1','ckplayer_a1','100%','400',false,flashvars,video,params); </script> "; } |
发布文章时加入:
1 | [ckplayer]http://www.wangchao.info/abc.mp4[/ckplayer] |
这样的标签即可添加视频了。
未经允许不得转载:王超博客 » WordPress添加视频短标签整合ckplayer播放器