wordpress中fuctions.php常用的函数

以下代码会长期持续添加中

<code>
// 为 WordPress 开启 HTML5 支持
function add_ie_html5_shim () {
    echo '<!--[if lt IE 9]>-->';
    echo '';
    echo '';
}
add_action('wp_head', 'add_ie_html5_shim');
// 引用jquery并确保只用一个jquery
if (!is_admin()) {
wp_deregister_script('jquery');
wp_register_script('jquery',("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"), false);
wp_enqueue_script('jquery');
}
// 去除头部不必要信息
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'feed_links', 2);
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'feed_links_extra', 3);
remove_action('wp_head', 'start_post_rel_link', 10, 0);
remove_action('wp_head', 'parent_post_rel_link', 10, 0);
remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
// 自定义摘要长度
function custom_excerpt_length($length) {
return 80;
}
add_filter('excerpt_length', 'custom_excerpt_length');
// 个性图标
function blog_favicon() {
echo '';
}
add_action('wp_head', 'blog_favicon');
/*
// 后台登陆LOGO修改
function custom_login_logo() {
echo '
h1 a { background-image:
url('.get_bloginfo('template_directory').'/images/apps.ico) !important; }
';
}
add_action('login_head', 'custom_login_logo');
*/
//去除自动更新提示
/*取消wordpress内核升级提示*/
add_filter('pre_site_transient_update_core',create_function('$a', "return null;"));remove_action('admin_init', '_maybe_update_core');
/*取消wordpress插件升级提示*/
add_filter('pre_site_transient_update_plugins', create_function('$a', "return null;"));remove_action('admin_init', '_maybe_update_plugins');
/*取消wordpress主题升级提示*/
add_filter('pre_site_transient_update_themes',  create_function('$a', "return null;"));remove_action('admin_init', '_maybe_update_themes');
</code>

0 thoughts on “wordpress中fuctions.php常用的函数
添加一条新回复 回到顶部

亲爱的,主人已经关闭了这篇文章的评论 。