如何修改去掉受保护的wordpress主题版权信息wordpress主题破解

相关技术 站长 浏览 评论

很多朋友好不容易下载到一个中意的wordpress主题后,希望把主题最下方的版权链接,或是广告链接去掉,或改成自己的,本来以为很容易做到的事,实际操作时确发现并不像自己想象的那么简单,出于某种原因,或者是收费主题,或者是作者的版权原因,总之,很多主题是不允许修改底部版权或广告链接的,今天我也遇到了同样问题.

直接修改footer.php文件后,再打开网站发现出现下面的错误信息:

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主题加密主要有两类方法。今天我要介绍的是其中的一类,大家可以模仿修改本类主题。

虽然本文教给大家一种解密办法,但本人还是建议尽量保留版权信息,其实对于大多数人来说并无大妨,毕竟主题设计者负出了心血与劳动,不交银子就去版权,好象道理上讲不过去。

好了,费话少说,进入正题。

只修改functions.php文件即可,网上有人介绍还要修改header.php,实践证明没有必要。

首先后台外观–>编辑–>打开functions.php文件–>搜索代码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 “<meta http-equiv=”refresh” content=”0;url=$theme_license_false”>”; exit(); } else { echo (“<p style=”padding:20px; margin: 20px; text-align:center; border: 2px dotted #0000ff; font-family:arial; font-weight:bold; background: #fff; color: #0000ff;”>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.</p>”); } }

先删除

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 “<meta http-equiv=”refresh” content=”0;url=$theme_license_false”>”; exit(); } else { echo (“<p style=”padding:20px; margin: 20px; text-align:center; border: 2px dotted #0000ff; font-family:arial; font-weight:bold; background: #fff; color: #0000ff;”>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.</p>”); }

其实就是将找到的那一大段代码变成

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: <a href=”http://www.apps4rent.com/free-microsoft-sharepoint-hosting-windows-wss-3-templates.html”>Free SharePoint</a> | Todays Current <a href=”http://wpthemesdir.com”>WordPress Themes Directory</a>, <a href=”http://wickedtour.net/wicked-pittsburgh”>Wicked Pittsburgh</a> and <a href=”http://freewpthemes.co”>WordPress Themes Free</a>’; $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: <a href=”http://www.apps4rent.com/free-microsoft-sharepoint-hosting-windows-wss-3-templates.html”>Free SharePoint</a> | Todays Current <a href=”http://wpthemesdir.com”>WordPress Themes Directory</a>, <a href=”http://wickedtour.net/wicked-pittsburgh”>Wicked Pittsburgh</a> and <a href=”http://freewpthemes.co”>WordPress Themes Free</a>’; $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文件就可以随便修改版权信息了。

看其来挺复杂,其实如果不需要做研究,那你只需要仔细对照,别改错了就行了。

转载请注明:网页阁吧 » 如何修改去掉受保护的wordpress主题版权信息wordpress主题破解