在启用loper1.3主题或者预览时,就会出现下面错误提示:
Fatal error: Cannot redeclare wp_embed_handler_youku() (previously declared in G:wpzhihtdocswp-contentlanguageszh_CN.php:94) in G:wpzhihtdocswp-contentthemesloper1.3functionsshortcode.php on line 44
具体情况看查看之前写的一篇文章
在上面的文章中也提到了出现错误提示的解决版本:
1、使用英文版的wordpress
2、用版本较低的中文版wordpress(3.4甚至以下版本)
而实际上并不需要那么麻烦,只需删除主题文件里面的一些过时的代码就行:
需要删除的代码如下:在主题文件下functions文件夹中的shortcode.php中
第43行到69行这些代码,删除!
[task]
////////////////////////
function wp_embed_handler_youku( $matches, $attr, $url, $rawattr ) { return apply_filters( ‘embed_youku’, ‘<embed src=”http://player.youku.com/player.php/sid/’ . esc_attr($matches[1]) . ‘/v.swf” quality=”high” width=”620″ height=”390″ align=”middle” allowScriptAccess=”sameDomain” type=”application/x-shockwave-flash” allowfullscreen=”true” wmode=”opaque”></embed>’, $matches, $attr, $url, $rawattr ); }
wp_embed_register_handler( ‘youku’, ‘#http://v.youku.com/v_show/id_(.*?).html#i’, ‘wp_embed_handler_youku’ );
function wp_embed_handler_tudou( $matches, $attr, $url, $rawattr ) { return apply_filters( ‘embed_tudou’, ‘<embed src=”http://www.tudou.com/v/’ . esc_attr($matches[1]) . ‘/v.swf” quality=”high” width=”620″ height=”390″ align=”middle” allowScriptAccess=”sameDomain” type=”application/x-shockwave-flash” allowfullscreen=”true” wmode=”opaque”></embed>’, $matches, $attr, $url, $rawattr );}
wp_embed_register_handler( ‘tudou’, ‘#http://www.tudou.com/programs/view/(.*?)/#i’, ‘wp_embed_handler_tudou’ );
function wp_embed_handler_ku6( $matches, $attr, $url, $rawattr ) { return apply_filters( ‘embed_ku6′, ‘<embed src=”http://player.ku6.com/refer/’ . esc_attr($matches[1]) . ‘/v.swf” quality=”high” width=”620″ height=”390″ align=”middle” allowScriptAccess=”sameDomain” type=”application/x-shockwave-flash” allowfullscreen=”true” wmode=”opaque”></embed>’, $matches, $attr, $url, $rawattr ); }
wp_embed_register_handler( ‘ku6′, ‘#http://v.ku6.com/show/(.*?).html#i’, ‘wp_embed_handler_ku6′ );
function wp_embed_handler_youtube( $matches, $attr, $url, $rawattr ) { return apply_filters( ‘embed_youtube’, ‘<embed src=”http://www.youtube.com/v/’ . esc_attr($matches[1]) . ‘?&hl=zh_CN&rel=0″ width=”620″ height=”390″ align=”middle” allowScriptAccess=”sameDomain” type=”application/x-shockwave-flash” allowfullscreen=”true” wmode=”opaque”></embed>’, $matches, $attr, $url, $rawattr ); }
wp_embed_register_handler( ‘youtube’, ‘#http://youtu.be/(.*?)/#i’, ‘wp_embed_handler_youtube’ );
function wp_embed_handler_56 ($matches, $attr, $url, $rawattr ) { return apply_filters( ‘embed_56′, ‘<embed src=”http://player.56.com/v_’ . esc_attr($matches[1]) . ‘.swf” quality=”high” width=”620″ height=”390″ align=”middle” allowScriptAccess=”sameDomain” type=”application/x-shockwave-flash” allowfullscreen=”true” wmode=”opaque”></embed>’, $matches, $attr, $url, $rawattr ); }
wp_embed_register_handler( ’56′, ‘#http://player.56.com/v_(.*?).swf#i’, ‘wp_embed_handler_56′ );
function wp_embed_handler_sohu( $matches, $attr, $url, $rawattr ) { return apply_filters( ‘embed_sohu’, ‘<embed src=”http://share.vrs.sohu.com/’ . esc_attr($matches[1]) . ‘/v.swf” quality=”high” width=”620″ height=”390″ align=”middle” allowScriptAccess=”sameDomain” type=”application/x-shockwave-flash” allowfullscreen=”true” wmode=”opaque”></embed>’, $matches, $attr, $url, $rawattr ); }
wp_embed_register_handler( ‘sohu’, ‘#http://share.vrs.sohu.com/(.*?)/v.swf#i’, ‘wp_embed_handler_sohu’ );
function wp_embed_handler_6cn( $matches, $attr, $url, $rawattr ) { return apply_filters( ‘embed_6cn’, ‘<embed src=”http://6.cn/p/’ . esc_attr($matches[1]) . ‘.swf” quality=”high” width=”480″ height=”385″ align=”middle” allowScriptAccess=”sameDomain” type=”application/x-shockwave-flash” allowfullscreen=”true” wmode=”opaque”></embed>’, $matches, $attr, $url, $rawattr ); }
wp_embed_register_handler( ’6cn’, ‘#http://6.cn/p/(.*?).swf#i’, ‘wp_embed_handler_6cn’ );
function wp_embed_handler_letv( $matches, $attr, $url, $rawattr ) { return apply_filters( ‘embed_letv’, ‘<embed src=”http://www.letv.com/player/’ . esc_attr($matches[1]) . ‘.swf” quality=”high” width=”620″ height=”390″ align=”middle” allowScriptAccess=”sameDomain” type=”application/x-shockwave-flash” allowfullscreen=”true” wmode=”opaque”></embed>’, $matches, $attr, $url, $rawattr ); }
wp_embed_register_handler( ‘letv’, ‘#http://www.letv.com/player/(.*?).swf#i’, ‘wp_embed_handler_letv’ );
function wp_embed_handler_sina( $matches, $attr, $url, $rawattr ) { return apply_filters( ‘embed_sina’, ‘<embed src=”http://you.video.sina.com.cn/api/sinawebApi/outplayrefer.php/vid=’ . esc_attr($matches[1]) . ‘/s.swf” quality=”high” width=”620″ height=”390″ align=”middle” allowScriptAccess=”sameDomain” type=”application/x-shockwave-flash” allowfullscreen=”true” wmode=”opaque”></embed>’, $matches, $attr, $url, $rawattr ); }
wp_embed_register_handler( ‘sina’, ‘#http://you.video.sina.com.cn/api/sinawebApi/outplayrefer.php/vid=(.*?)/s.swf#i’, ‘wp_embed_handler_sina’ );
[/task]
删除后loper主题就能正常启用了!
最后附上懒人代码包:http://www.pipipan.com/file/50660768
将里面的文件覆盖主题文件下functions文件夹中的shortcode.php即可;
此方法原理:lopre主题适用wordpress版本是3.4及以前的,这些视频代码也是过时的了;
而在3.4版本以后,中文版的wordpress早把英文版的视频代码改掉了,所以现在的中文版也就无法启用了;
版本问题,有的也可能是模板问题!模板也不需要换来换去!
@彩虹之家: 主题里面的一些代码过时了,说的对、以后再换模版了!
@guoaibing: 额/不再轻易换了
赞一个好分享