使用wordpress的朋友都知道国外制作的主题非常好看,于是就到外国的网站搜索下载一个自己喜欢的wordpress主题,但是当下载回来的主
题想修改模板里的footer的版权信息时却不能修改,就算能修改但是已访问博客是就出现错误。错误信息显示:
“All the links in the footer should remain intact. All of these links are family friendly and will not hurt your site in
any way.”
出现这种情况是出于某种原因,或者是收费主题,或者是作者的版权原因,总之,很多主题是不允许修改底部版权或广告链接的。那有办法
修改吗?有的。
因为国外对于版权看得很重,外国人制作的wordpress主题加密主要有两类方法。今天介绍的是其中的一类,大家可以模仿修改本类主题(另
一类是用base64位加密的,操作起来很麻烦,所以不介绍这一类了)。
虽然本文教给大家一种解密办法,但建议尽量保留版权信息,其实对于大多博主来说并无大妨,毕竟人家制作的主题设计者负出了心血与劳
动,免费使用人家的作品还去版权,好象人品上讲不过去。好了,废话不说了,进入操作步骤:
网上有人介绍还要修改header.php,实践证明没有必要,只需修改functions.php文件即可。
第一步:打开主题的functions.php模板函数,然后用快捷键“ctrl+f”查找“wp_initialize_the_theme”
找到下面的一段代码:
“if (!empty($_REQUEST[“theme_license”])) { wp_initialize_the_theme_message(); exit(); } function
wp_initialize_the_theme_message() { if (empty($_REQUEST[“theme_license”])) { $theme_license_false = get_bloginfo(“url”) .
“/index.php?theme_license=true”; echo “”; exit(); } else { echo (“
All the links in the footer should remain intact. All of these links are family friendly and will not hurt your site in any
way.
”); } }”
先删除
“if (!empty($_REQUEST[“theme_license”])) { wp_initialize_the_theme_message(); exit(); }”
接着再删除
“if (empty($_REQUEST[“theme_license”])) { $theme_license_false = get_bloginfo(“url”) . “/index.php?theme_license=true”
; echo “”; exit(); } else { echo (“
All the links in the footer should remain intact. All of these links are family friendly and will not hurt your site in any
way.
”); }”
其实就是把这段代码变成下面这句代码:
“function wp_initialize_the_theme_message() { }”
第二步:找到下面的一段代码
“function wp_initialize_the_theme_finish() { $uri = strtolower($_SERVER[“REQUEST_URI”]); if(is_admin() || substr_count
($uri, “wp-admin”) > 0 || substr_count($uri, “wp-login”) > 0 ) { /* */ } else { $l = ‘Designed by: Free SharePoint |
Todays Current WordPress Themes Directory, Wicked Pittsburgh and WordPress Themes Free’; $f = dirname(__file__) .
“/footer.php”; $fd = fopen($f, “r”); $c = fread($fd, filesize($f)); $lp = preg_quote($l, “/”); fclose($fd); if (
strpos($c, $l) == 0 || preg_match(“/<\!–(.*” . $lp . “.*)–>/si”, $c) || preg_match(“/<\?php([^\?]+[^>]+” . $lp . “
.*)\?>/si”, $c) ) { wp_initialize_the_theme_message(); die; } } } wp_initialize_the_theme_finish();”
删除
“$uri = strtolower($_SERVER[“REQUEST_URI”]); if(is_admin() || substr_count($uri, “wp-admin”) > 0 || substr_count($uri,
“wp-login”) > 0 ) { /* */ } else { $l = ‘Designed by: Free SharePoint | Todays Current WordPress Themes Directory,
Wicked Pittsburgh and WordPress Themes Free’; $f = dirname(__file__) . “/footer.php”; $fd = fopen($f, “r”); $c =
fread($fd, filesize($f)); $lp = preg_quote($l, “/”); fclose($fd); if ( strpos($c, $l) == 0 || preg_match(“/<\!–(.*” .
$lp . “.*)–>/si”, $c) || preg_match(“/<\?php([^\?]+[^>]+” . $lp . “.*)\?>/si”, $c) ) {
wp_initialize_the_theme_message(); die; } }”
将这一段变成
“function wp_initialize_the_theme_finish() { } wp_initialize_the_theme_finish();”
第三步:找到下面的一段代码
“function wp_initialize_the_theme_load() { if (!function_exists(“wp_initialize_the_theme”)) {
wp_initialize_the_theme_message(); die; } }”
删除
“if (!function_exists(“wp_initialize_the_theme”)) { wp_initialize_the_theme_message(); die; }”
将这一段变成
“function wp_initialize_the_theme_load() { }”
修改完之后更新functions.php文件,再打开footer.php文件就可以随便修改版权那里的信息了。