Modification

1 Plugins 插件

NameAuthor
Akismet Anti-SpamAutomattic
Easy WP CleanerNikunj Soni
EnlighterAndi Dittrich
Sync QCloud COS沈唁
Wenprise Better EmailsWordPress 智库
WP Mail SMTPWPForms
WP-China-YesWP中国本土化社区
WPS Hide LoginWPServeur, NicolasKulka, tabrisrp
失效链接检查器WPMU DEV
Updated on Mar. 14 2021

2 Theme 主题

2.1 Style.css

2.1.1 自定义 – 额外 CSS

label {
 --fontSize: 14px;
}

.gdpr-confirm-policy label,
.comment-form-cookies-consent label {
 --fontSize: 14px;
}

2.1.2 主题编辑器 子主题 style.css

暂无。

2.2 functions.php

Updated on 2 Apr. 2021

<?php

//替换Gravatar源
//function my_get_avatar( $avatar ) {
//    $avatar = preg_replace("/https:\/\/(secure|\d).gravatar.com\/avatar\//","https://cdn.v2ex.com/gravatar/",$avatar);
//    return $avatar;
//}
//add_filter('get_avatar', 'my_get_avatar');

//禁用 WP Editor Google 字体
//function remove_gutenberg_styles($translation, $text, $context, $domain)
//{
//    if($context != 'Google Font Name and Variants' || $text != 'Noto Serif:400,400i,700,700i') {
//        return $translation;
//    }
//    return 'off';
//}
//add_filter( 'gettext_with_context', 'remove_gutenberg_styles',10, 4);

//古腾堡编辑器默认字体样式
//function custom_admin_css() {
//    echo '<style type="text/css">
// .editor-rich-text.block-editor-rich-text {
//     font-family: sans-serif;
//     color: #f1f2f3;
// }
//    </style>';
//}
//add_action('admin_head', 'custom_admin_css');

//禁止缩略图生成
//add_filter( 'max_srcset_image_width', create_function( '', 'return 1;' ) );

//保持文章id连续性
function Bing_post_id_continuous_query(){
set_time_limit( 0 );
remove_action( 'publish_post', 'Bing_post_id_continuous' );
query_posts( 'posts_per_page=-1' );
$arr = array();
while( have_posts() ){
the_post();
$post_id = $GLOBALS['post']->ID;
$arr[] = $post_id;
}
wp_reset_query();
$arr = array_reverse( $arr );
$i = 1;
foreach( $arr as $post_id ){
wp_update_post( array(
'ID' => $post_id,
'post_name' => $i++
) );
}
}
if( $_GET['post_id_continuous_query'] == 'yes' && current_user_can( 'level_10' ) ) add_action( 'init', 'Bing_post_id_continuous_query' );

//禁用自动保存
//    add_action('wp_print_scripts', 'qgg_not_autosave');
//    function qgg_not_autosave() {
//        wp_deregister_script('autosave');
//    }

//禁用文章修订
//    add_filter( 'wp_revisions_to_keep', 'qgg_wp_revisions_to_keep', 10, 2 );
//    function qgg_wp_revisions_to_keep( $num, $post ) {
//        return 0;
//    }

//替换 WordPress 默认 Emoji 资源地址
function theme_wp_emoji_baseurl( $url ){
    return set_url_scheme('//cos.hxghak.net/emoji/72x72/');
}
add_filter('emoji_url', 'theme_wp_emoji_baseurl');

//WordPress 4.6 新增 SVG 格式资源
function theme_wp_emoji_svgurl($url) {
    return set_url_scheme('//cos.hxghak.net/emoji/svg/');
}
add_filter('emoji_svg_url', 'theme_wp_emoji_svgurl');

//评论框下方 cookie 纪录提示
function comment_form_change_cookies_consent( $fields ) {
	$commenter = wp_get_current_commenter();
	$consent   = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"';
	$fields['cookies'] = '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . $consent . ' />' .
					 '<label for="wp-comment-cookies-consent">Save my name, email, and website in this browser.</label></p>';
	return $fields;
}
add_filter( 'comment_form_default_fields', 'comment_form_change_cookies_consent' );

//替换 googleapis 源为 dogedoge cdn,直接替换源地址 fonts.googleapis.com 为 fonts.dogedoge.com