WordPress主题去版权保护修改的方法一

copyright

首先声明一下:本教程只是为了方便各位学习,本博不推荐大家删除WP主题发布者连接,毕竟所发布的主题代表了别人的辛勤,在使用别人提供的免费主题时保留发布者的链接是一种对别人的尊重。鉴于有些主题发布者在发布的时候添加了一大堆无用的链接,影响美观和网页布局,所以适当的修改也是势在必行的,所以各位童鞋斟酌噶。
很多朋友好不容易下载到一个中意的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主题加密主要有两类方法。一种是直接代码直接被加密,另外一种是通过PHP语言的特性实现加密功能。学习本教程大家可以模仿修改本类主题。
针对上述英文提示的代码加密修改方法如下:进入后台管理页面,打开你的主题,定位functions.php文件,搜索代码:

1
 wp_initialize_the_theme

第一步:找到下面的一段代码

1
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>”); } }

删除如上该段代码,并在原来位置用如下代码填充代替

1
function wp_initialize_the_theme_message() { }

第二步:继续向下找到该段代码

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

整段代码删除,并用如下代码代替填入原有位置

1
function wp_initialize_the_theme_finish() {} wp_initialize_the_theme_finish();

第三步:找到下面的一段代码

1
function wp_initialize_the_theme_load() { if (!function_exists(“wp_initialize_the_theme”)) { wp_initialize_the_theme_message(); die; } }

整段代码删除,复制以下内容填充进去

1
function wp_initialize_the_theme_load() {}

点击保存,完成对functions.php文件的修改后,再打开footer.php文件就可以随便修改版权信息了。 看其来挺复杂,其实如果不需要做研究,那你只需要仔细对照,别改错了就行了。

暂无相关文章,请随便看看。

You can leave a response, or trackback from your own site.

Leave a Reply

Powered by WordPress Designed by: WPtheme