WordPress新站需要修改的7个代码

王朝学院·作者佚名  2016-08-22
窄屏简体版  字體: 小  |  中  |  大  |  超大  

1、修改默认登录logo

functioncustom_login_logo(){echo'<style type="text/CSS">h1 a { background-image:url('.get_bloginfo('template_directory').'/images/login_logo.png) !important; }</style>';}add_action('login_head','custom_login_logo');

2、预览模式下取消google分析自动运行

if(!is_PReview()):# Google Analytics Code #endif;

3、激活小工具段代码

add_filter('widget_text','do_shortcode');

4、启用网站维护模式

functionmaintenace_mode(){if(!current_user_can('administrator')){wp_die('The site will be up soon.');}}add_action('get_header','maintenace_mode');

5、取消更新通知

if(!current_user_can('administrator')){add_action('init',create_function('$a',"remove_action( 'init', 'wp_version_check' );"),2);add_filter('pre_option_update_core',create_function('$a',"return null;"));}

6、取消自我追踪

functiondisable_self_ping(&$links){foreach($linksas$l=>$link)if(0===strpos($link,get_option('home')))unset($links[$l]);}add_action('pre_ping','disable_self_ping');

7、自定义可是编辑器css

$your_custom_stylesheet='css/custom-editor-style.css';add_editor_style($your_custom_stylesheet);

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航