ck6.8整合php,WordPress整合ckplayer X和ckplayer 6.8的最新完美代码

WordPress整合ckplayer X和ckplayer 6.8的最新完美代码,网上也有很多代码,但是都有些问题,正好自己有个网站需要用这个播放器,就把网上资源拿来研究了下,目前ckplayer X和ckplayer 6.8都可以完美应用。

9ad236f647a1d307bb6272c61b424787.png

1.下载ckplayer X最新版本或者6.8版本, 解压后将ckplayer上传到WP网站根目录

2.找到 /wp-content/themes/主题名称/functions.php 文件,在“functions.php”里面添加代码。

ckplayer X代码

//调用Ckplayer播放代码开始

add_shortcode("ckplayer","ipc_ckplayer");

function ipc_ckplayer( $atts, $content=null )

{

return "

var videoObject = {

container: '#a1',

variable: 'player',

flashplayer:false,

video:'".$content."'

};

var player=new ckplayer(videoObject);

";

}

//调用Ckplayer播放代码结束

//后台增加短代码按钮开始

function appthemes_add_quicktags() {

?>

QTags.addButton( 'ckplayer', 'ckplayer', '[ckplayer]', '[/ckplayer]' );

}

add_action('admin_print_footer_scripts', 'appthemes_add_quicktags' );

//后台增加短代码按钮

ckplayer 6.8代码

add_shortcode("wp_ckplayer","wp_ckplayer");

function wp_ckplayer( $atts, $content=null )

{

return "

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);

";

}

add_action('after_wp_tiny_mce', 'bolo_after_wp_tiny_mce');

function bolo_after_wp_tiny_mce($mce_settings) {

?>

QTags.addButton( 'wp_ckplayer', '视频地址', "[wp_ckplayer]视频地址[/wp_ckplayer]" );

function bolo_QTnextpage_arg1() {

}

3.增加代码后保存重新上传到该模板目录对应位置覆盖,后台写文章时在文本编辑模式下,编辑框上方小图标最后面有ckplayer或者wp_ckplayer,直接点击,即可在编辑器里出现[ckplayer]视频地址[/ckplayer]或者[wp_ckplayer]视频地址[/wp_ckplayer]。

代码如果网页上直接复制有问题的话可以在这里下载文本格式再复制

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值