dontfear 762 Posted January 20, 2015 Report Share Posted January 20, 2015 Делитесь хуками, которые используете на своих сайтах. Удаляем из head мусор remove_action( 'wp_head', 'feed_links' ); // Удаляем информацию о rss remove_action( 'wp_head', 'feed_links_extra' ); // Удаляем информацию о выводе RSS фида для записей, тегов, рубрик и т.д. remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 ); // Удаление короткой ссылки к статье remove_action('wp_head','rsd_link'); // Удаление информации о использовании rsd remove_action('wp_head','wlwmanifest_link'); // Удаление информации о использовании wlwmanifest remove_action( 'wp_head', 'wp_generator' ); // Удаление информации о том, что сайт использует WP и его версию. Добавление дополнительных тегов в текстовый редактор // Добавление тегов в текстовый редактор, в моем случае используется shortcode [raw] плагина Raw HTML https://wordpress.org/plugins/raw-html/ if( !function_exists('bloggood_ru_quicktags') ){ function bloggood_ru_quicktags() { ?> <script type="text/javascript"> QTags.addButton( 'p', 'p', '<p>', '</p>' ); QTags.addButton( 'hr', 'hr', '[raw]<hr>[/raw]', '' ); QTags.addButton( 'br', 'br', '[raw]<br>[/raw]', '' ); QTags.addButton( 'raw', 'raw', '[raw]', '[/raw]' ); </script> <?php } add_action('admin_print_footer_scripts', 'bloggood_ru_quicktags'); } Добавление рекламного блока после more function adsgoolge_ssd($content) { $google_ads=' // Здесь код '; $content=preg_replace('#<span.*?id="more-(.*?)".*?></span>#','<span id="more-\1"></span></p>'.$google_ads.'<BR><p style="text-align: justify;">',$content); return $content; } add_filter('the_content', 'adsgoolge_ssd'); Перенос JS из head в footer function footer_enqueue_scripts() { remove_action('wp_head', 'wp_print_scripts'); remove_action('wp_head', 'wp_print_head_scripts', 9); remove_action('wp_head', 'wp_enqueue_scripts', 1); add_action('wp_footer', 'wp_print_scripts', 5); add_action('wp_footer', 'wp_enqueue_scripts', 5); add_action('wp_footer', 'wp_print_head_scripts', 5); } add_action('after_setup_theme', 'footer_enqueue_scripts'); campusboy, Vitaliy, GladWeb and 2 others 5 Link to post Share on other sites
Makedo 291 Posted January 20, 2015 Report Share Posted January 20, 2015 @dontfear,по поводу переноса JS из шапки в футер: куда этот код прописать? Link to post Share on other sites
dontfear 762 Posted January 20, 2015 Author Report Share Posted January 20, 2015 @Makedo, Все хуки вписываются в function.php Makedo 1 Link to post Share on other sites
Makedo 291 Posted January 20, 2015 Report Share Posted January 20, 2015 @dontfear, как обычно в конце? Link to post Share on other sites
VIP campusboy 912 Posted January 20, 2015 VIP Report Share Posted January 20, 2015 как обычно в конце? В принципе в любое место там. Makedo 1 Link to post Share on other sites
Makedo 291 Posted January 20, 2015 Report Share Posted January 20, 2015 Спасибо! Link to post Share on other sites
dontfear 762 Posted January 20, 2015 Author Report Share Posted January 20, 2015 @Makedo, <?php // в любом месте внутри <?php ?> ?> Makedo 1 Link to post Share on other sites
mnogofilenet 12 Posted January 20, 2015 Report Share Posted January 20, 2015 Спасибо! Link to post Share on other sites
mnogofilenet 12 Posted January 20, 2015 Report Share Posted January 20, 2015 только вот это у меня не удаляется remove_action( 'wp_head', 'feed_links' ); // Удаляем информацию о rss remove_action( 'wp_head', 'feed_links_extra' ); // Удаляем информацию о выводе RSS фида для записей, тегов, рубрик и т.д. версия 4.1 Link to post Share on other sites
dontfear 762 Posted January 20, 2015 Author Report Share Posted January 20, 2015 @mnogofilenet, Значит RSS выводится не стандартным методом Link to post Share on other sites
mnogofilenet 12 Posted January 20, 2015 Report Share Posted January 20, 2015 как изменить? Link to post Share on other sites
VIP campusboy 912 Posted January 20, 2015 VIP Report Share Posted January 20, 2015 как изменить? Если вывод не стандартный, значит или плагин меняет или тема у вас навороченная. Надо там копать. Link to post Share on other sites
mnogofilenet 12 Posted January 20, 2015 Report Share Posted January 20, 2015 ясно Link to post Share on other sites
makissm 42 Posted January 20, 2015 Report Share Posted January 20, 2015 Это мой стандартный набор) /* * Обрезка заголовков the_title */ function trim_title_chars($count, $after) { $title = get_the_title(); if (mb_strlen($title) > $count) $title = mb_substr($title,0,$count); else $after = ''; echo $title . $after; } /* *Убираем активные пункты меню при 404 ошибке и поиске */ function modify_css_class($css_class, $page) { if (is_404() || is_search()) { foreach ($css_class as $k=>$v) { if ($v=='current_page_parent') unset($css_class[$k]); } } return $css_class; } add_filter('nav_menu_css_class','modify_css_class',10,2); /* * Удаляем пункты меню из админки */ function remove_menus() { global $menu; $restricted = array( __('Links'), // Ссылки ); end ($menu); while (prev($menu)) { $value = explode(' ', $menu[key($menu)][0]); if (in_array($value[0] != NULL ? $value[0] : "" , $restricted)) { unset($menu[key($menu)]); } } } add_action('admin_menu', 'remove_menus'); /* * Меняем надпись wordpress на свою */ function remove_footer_admin () { echo "Разработчик"; } add_filter('admin_footer_text', 'remove_footer_admin'); if ( !current_user_can( 'edit_users' ) ) { add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 ); add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) ); } /* * Удаляем кнопки с панели администрирования */ function my_remove_admin_bar_links() { global $wp_admin_bar; $wp_admin_bar->remove_menu('wp-logo'); // Remove the WordPress logo } add_action('wp_before_admin_bar_render', 'my_remove_admin_bar_links'); /* Меняем стиль входа в админку */ function login_enqueue_scripts(){ echo ' <div></div> <style type="text/css" media="screen"> #login{padding: 4% 0 0;} .login h1 a{background:none!important;} } </style> '; } add_action( 'login_enqueue_scripts', 'login_enqueue_scripts' ); /* *Удаляем тег <p> из the excerpt (); */ remove_filter ('the_excerpt', 'wpautop'); campusboy 1 Link to post Share on other sites
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now