Исключить ссылки на картинки в sitemap.xml (избавиться от предупреждений Yandex Webmaster: Неизвестный тег image:image)
в файле functions.php активной темы:
add_filter('wpseo_xml_sitemap_img',__return_false);
Исключить ссылки на картинки в sitemap.xml (избавиться от предупреждений Yandex Webmaster: Неизвестный тег image:image)
в файле functions.php активной темы:
add_filter('wpseo_xml_sitemap_img',__return_false);
в functions.php темы:
function my_user_contactmethods($user_contactmethods){ $user_contactmethods['phone']='Телефон'; return $user_contactmethods; } add_filter('user_contactmethods','my_user_contactmethods');
Для новых записей — в настройках обсуждения. Для всех, ранее созданных — в phpmyadmin:
UPDATE `wp_posts` SET `ping_status`='closed';
<?php echo do_shortcode('[contact-form-7 id="259" title="Форма для контакта 1"]'); ?>
Изменение БД:
Добавляем поля в таблицу wp_posts
Добавление полей в форму редактирования записи:
/wp-admin/edit-form-advanced.php
например после div с заголовком:
<input type="text" name="post_title" size="30" tabindex="1" value="<?php echo esc_attr( htmlspecialchars( $post->post_title ) ); ?>" id="title" autocomplete="off" />
Сохранение указанных значений:
/wp-includes/post.php
изменения вносятся в функцию wp_insert_post
(добавляем свои поля в массив)
$data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'guid' ) );
1. Скачиваем файлы lavalamp.js и lava.gif.
2. В папке с темой: lavalamp.js
копируем в папку js
. lava.gif
копируем в папку img
.
3. В header.php
после того как подключили jquery:
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/lavalamp.js"></script> <script type="text/javascript"> jQuery(document).ready( function(){ jQuery(function() { jQuery("#menus").lavaLamp({fx:"backout", speed:700}) }); } ) </script>
4. В templates/header.php
удаляем:
<li><a class="lastmenu" href="javascript:void(0);"></a></li>
5. В js/menu.js
изменяем:
activate: function() { if(this.sub == 1) { var pos = currentOffset(this.title); var top = pos[1] - 1; var left = getWidth(this.body) - 2; if (this.align == 'right') { var left = getWidth(this.body) * (-1); } } else { var pos = cumulativeOffset(this.title); var top = pos[1] + getHeight(this.title); var left = pos[0]; if (this.align == 'right') { left += getWidth(this.title) - getWidth(this.body); } } if(!/current/.test(this.title.className)) { this.title.className += ' current'; } setStyle(this.body, 'left', left + 'px'); setStyle(this.body, 'top', top + 'px'); setStyle(this.body, 'visibility', 'visible'); }
на:
activate: function() { this.title.className += ' current'; var pos = cumulativeOffset(this.title); var left = pos[0]; if (this.align == 'right') { var offset = getWidth(this.title) - getWidth(this.body) + this.offset; left += offset; } var top = pos[1] + getHeight(this.title); if(this.offset == -1) { var pos2 = cumulativeOffset(document.getElementById('navigation')); left -= pos2[0]; top -= pos2[1]; } setStyle(this.body, 'left', left + 'px'); setStyle(this.body, 'top', top + 'px'); setStyle(this.body, 'visibility', 'visible'); setStyle(this.body, 'opacity', this.opacity); setStyle(this.body, 'MozOpacity', this.opacity); setStyle(this.body, 'KhtmlOpacity', this.opacity); setStyle(this.body, 'filter', 'alpha(opacity=' + this.opacity * 100 + ')'); if(this.tid) { clearTimeout(this.tid); } this.tid = setInterval(bind(this, this.appear), 20); }
5. В style.css
удаляем все стили, содержащие #menus
и добавляем:
#menus { position:relative; padding-left:10px; float:left; } #menus li { float:left; display:inline; list-style:none; } #menus li a { position:relative; color:#382E1F; height:30px; line-height:30px; padding:0 20px; text-decoration:none; font-size:11px; float:left; z-index:10; text-align:center; } #menus li.current_page_item a { font-weight:bolder; } #menus li.back { background:url(img/lava.gif) no-repeat right bottom; height:30px; position:absolute; z-index:8; } #menus li.back .left { background:url(img/lava.gif) no-repeat left top; height:30px; margin-right:9px; float:none; } #menus li ul { display:none; background:#F4F5F7; border:1px solid #CCC; border-top-color:#A6A6A6; padding:0 5px; } #menus li li { float:none; margin:0 !important; margin:0; padding:0; display:block; list-style:none; } #menus li li a { float:none; display:block; padding:7px 5px; text-decoration:none; width:200px; border-style:solid; border-color:#DDD; border-width:1px 0 0; margin:0; background-image:none; height:auto; line-height:145%; color:#999; text-align:left; } #menus li li.first a { border-top:none; } #menus li li a:hover { color:#382E1F; }
Для других тем как-то по аналогии.
1.В используемой теме редактируем файл functions.php
. Дописываем:
<?php function preg_callback2($matches) { $url = explode(':', $matches[2]); if (($url[0] == 'http') || ($url[0] == 'https')) { $need = "http://krylov.org.ua"; $replace = "http://krylov.org.ua/redirect.php?"; if (substr($matches[2], 0, strlen($need)) != $need) { $matches[2] = $replace.$matches[2]; } } return $matches[1].$matches[2].$matches[3]; } function removeLinks($content) { if (! is_feed()) { $content = preg_replace_callback('@(]*href=")([^>\"]*)("[^>]*>)@i', "preg_callback2", $content); $content = preg_replace_callback('@(]*href=\')([^>\"]*)(\'[^>]*>)@i', "preg_callback2", $content); } return $content; } add_filter('the_content', 'removeLinks'); add_filter('comment_text', 'removeLinks'); add_filter('get_comment_author_link', 'removeLinks'); add_filter('get_comment_author_url_link', 'removeLinks'); add_filter('comment_url', 'removeLinks'); add_filter('wp_list_bookmarks', 'removeLinks'); ?>
wp_list_bookmarks
— функиция, используемая для отображения ссылок из blogroll, если вы используете другую функцию замените на другое значение.
2. Содержание файла redirect.php
, который помещаем в корень сайта:
<?php $uri = ""; if (array_key_exists("QUERY_STRING", $_SERVER)) { $uri = $_SERVER["QUERY_STRING"]; } header("Location: ".$uri); ?>
3. Запрещаем индексирование обрабатываемых ссылок поисковиками. В robots.txt
в корне сайта пишем:
User-Agent: * Disallow: /redirect.php
4. Чтобы в браузере ссылки выглядели как обычно после открытия <body>
подключаем jquery и следующий js-скрипт:
$(document).ready(function(){ $("a").each(function(i){ var remove_str = 'http://krylov.org.ua/redirect.php?'; var str = this.href.substring(0, remove_str.length); if (str == remove_str) { this.href = this.href.substring(remove_str.length); } }); });