Как убрать ссылки в шаблоне WordPress от NewWpThemes (полное руководство)
Многим блогерам нравятся шаблоны от NewWpThemes: они красивые, оригинальные и удобные, но, есть один недостаток — в них присутствуют внешние ссылки, встречал, что называют их еще копирайты.
Сегодня я опишу пошагово процесс, как удалить ссылки в шаблоне WordPress от NewWpThemes. Для примера буду использовать шаблон Avia
Рекомендую использовать программу Notepad++ v6.5.5, в которой вы сможете изменять код, только после этого закачивая на сервер. Создайте бекапы файлов, с которыми будете работать.
1) Сначала в файле functions.php находим код, функцию, которая вызывает лицензирование шаблона, и удаляем ее. Вот ее вид:
-
function wp_initialize_the_theme_load() { if (!function_exists(«wp_initialize_the_theme»)) { wp_initialize_the_theme_message(); die; } } 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 = ‘ | Theme Designed by: <?php echo wp_theme_credits(0); ?> | Thanks to <?php echo wp_theme_credits(1); ?>, <?php echo wp_theme_credits(2); ?> and <?php echo wp_theme_credits(3); ?>’; $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();
2) Далее удаляем код, который вызывает ошибку в работе сайта, при неправильном удалении защиты, либо удалении какой-либо ссылки. Ищем и удаляем там такие строчки:
-
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 https-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>»); } }
3) Далее в этом же файле необходимо найти строчку:
-
if(!function_exists(‘get_sidebars’)) { function get_sidebars($the_sidebar = ») { wp_initialize_the_theme_load(); get_sidebar($the_sidebar); } }
и заменить ее на эту:
-
if(!function_exists(‘get_sidebars’)) { function get_sidebars($the_sidebar = ») { get_sidebar($the_sidebar); } }
Может быть еще будет такого рода код:
- 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=»https://allpremiumthemes.com»>All Premium Themes</a> | Thanks to <a href=»https://freewpthemes.co»>wordpress themes free</a>, Best <a href=»https://freewpthemes.co»>Free WordPress Themes</a> and <a href=»https://freewpthemes.co»>Free WordPress Themes</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();
Удаляем
и такой
- <div class=»wrap»><h2><?php echo $themename; ?> Theme Options | <a href=»https://newwpthemes.com/forum/» target=»_blank» style=»font-size: 14px;»>NewWpThemes.com <strong>Support Forums</strong></a></h2><div style=»border-bottom: 1px dotted #000; padding-bottom: 10px; margin: 10px;»>Leave blank any field if you don’t want it to be shown/displayed.</div><?php $buy_theme_name = str_replace(‘ ‘, ‘-‘, strtolower(trim($themename))); ?><div id=»buy_theme» class=»updated» style=»padding: 10px; margin: 10px;»>You can buy this theme without footer links online at <a href=»https://newwpthemes.com/buy/?theme=<?php echo $buy_theme_name; ?>» target=»_blank»>https://newwpthemes.com/buy/?theme=<?php echo $buy_theme_name; ?></a></div>
Удаляем
4) Предпоследним шагом открываем файл header.php и ищем код, который расположен в самом начале файла и удаляем его:
-
<?php function wp_initialize_the_theme() { if (!function_exists(«wp_initialize_the_theme_load») || !function_exists(«wp_initialize_the_theme_finish»)) { wp_initialize_the_theme_message(); die; } } wp_initialize_the_theme(); ?>
5) Последним шагом открываем файл footer.php и ищем код который якобы удалять нельзя
типа:
- <?php // This theme is released free for use under creative commons licence. https://creativecommons.org/licenses/by/3.0/ // All links in the footer should remain intact. // These links are all family friendly and will not hurt your site in any way. // Warning! Your site may stop working if these links are edited or deleted // You can buy this theme without footer links online at https://newwpthemes.com/buy/ ?><div id=»footer2″>Powered by <a href=»https://wordpress.org/»><strong>WordPress</strong></a> | Designed by: <a href=»https://allpremiumthemes.com»>All Premium Themes</a> | Thanks to <a href=»https://freewpthemes.co»>wordpress themes free</a>, Best <a href=»https://freewpthemes.co»>Free WordPress Themes</a> and <a href=»https://freewpthemes.co»>Free WordPress Themes</a></div>
и удаляем его. Все.
По мотивам https://iglous.ru/kak-ubrat-ssylki-v-shablone-wordpress-ot-newwpthemes/ только с дополнениями
Получилось! Удалил 6 защищенных ссылок.
Код был не один в один как у тебя в примере но ключи те же, просто нужно знать где начало и конец кода что бы удалить его «без остатка» и не зацепить нужный . Автору темы респект! где кнопка поблагодарить/купить кофе?
Кнопка справа)
Спасибо за советы, почистил тему) Все получилось, ссылка снизу сайта исчезла! Ура!