本博客程序为WordPress 4.8.13,模板Twenty Seventeen。同时,做以下调整。
安装插件。
语法高亮,Enlighter - Customizable Syntax Highlighter
google字体修改,Google Font Fix
登录防护,Login LockDown
站点地图,XML Sitemap & Google News
静态缓存,WP Super Cache
禁止自动更新,Disable All WordPress Updates、Disable plugins/themes updates
清理草稿、修订版本、数据库,Easy WP Cleaner
修改style.css、wp-includes/js/tinymce/skins/wordpress/wp-content.css、wp-content/plugins/enlighter/resources/EnlighterJS.min.css、/WEB/wp-content/plugins/enlighter/cache/TinyMCE.css默认字体。
font-family: Arial, "Microsoft YaHei", "Droid Sans Fallback", "Hiragino Sans GB", Simsun, sans-serif;
修改footer.php,增加备案号。
<?php /** * The template for displaying the footer * * Contains the closing of the #content div and all content after. * * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials * * @package WordPress * @subpackage Twenty_Seventeen * @since Twenty Seventeen 1.0 * @version 1.2 */ ?> </div><!-- #content --> <footer id="colophon" class="site-footer" role="contentinfo"> <div class="wrap"> <?php get_template_part( 'template-parts/footer/footer', 'widgets' ); if ( has_nav_menu( 'social' ) ) : ?> <nav class="social-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Footer Social Links Menu', 'twentyseventeen' ); ?>"> <?php wp_nav_menu( array( 'theme_location' => 'social', 'menu_class' => 'social-links-menu', 'depth' => 1, 'link_before' => '<span class="screen-reader-text">', 'link_after' => '</span>' . twentyseventeen_get_svg( array( 'icon' => 'chain' ) ), ) ); ?> </nav><!-- .social-navigation --> <?php endif; get_template_part( 'template-parts/footer/site', 'info' ); ?> </div><!-- .wrap --> </footer><!-- #colophon --> </div><!-- .site-content-contain --> </div><!-- #page --> <?php wp_footer(); ?> </body> </html>
改为,
<?php /** * The template for displaying the footer * * Contains the closing of the #content div and all content after. * * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials * * @package WordPress * @subpackage Twenty_Seventeen * @since 1.0 * @version 1.2 */ ?> </div><!-- #content --> <footer id="colophon" class="site-footer" role="contentinfo"> <div class="wrap"> <center><a href="http://www.beian.miit.gov.cn" target='_blank' >京ICP备18056516号</a><center> </div><!-- .wrap --> </footer><!-- #colophon --> </div><!-- .site-content-contain --> </div><!-- #page --> <?php wp_footer(); ?> </body> </html>
增加ICO。
上传a.ico于根目录。修改主题下面的header.php,在<head>...</head>中插入,
<link id="favicon" href="https://www.misaraty.com/a.ico" rel="icon" type="image/x-icon" />
禁止英文引号转中文。
打开wp-includes/formatting.php,注释以下部分,
$curl = str_replace( $static_characters, $static_replacements, $curl ); if ( false !== strpos( $curl, "'" ) ) { $curl = preg_replace( $dynamic_characters['apos'], $dynamic_replacements['apos'], $curl ); $curl = wptexturize_primes( $curl, "'", $prime, $open_sq_flag, $closing_single_quote ); $curl = str_replace( $apos_flag, $apos, $curl ); $curl = str_replace( $open_sq_flag, $opening_single_quote, $curl ); } if ( false !== strpos( $curl, '"' ) ) { $curl = preg_replace( $dynamic_characters['quote'], $dynamic_replacements['quote'], $curl ); $curl = wptexturize_primes( $curl, '"', $double_prime, $open_q_flag, $closing_quote ); $curl = str_replace( $open_q_flag, $opening_quote, $curl ); } if ( false !== strpos( $curl, '-' ) ) { $curl = preg_replace( $dynamic_characters['dash'], $dynamic_replacements['dash'], $curl ); }
文章以摘要模式显示。
修改index.php,
get_template_part( 'template-parts/post/content', get_post_format() );
改为,
get_template_part( 'template-parts/post/content','excerpt',get_post_format() );
修改archive.php,
get_template_part( 'template-parts/post/content', get_post_format() );
改为,
get_template_part( 'template-parts/post/content', 'excerpt', get_post_format() );
修改wp-includes/formatting.php,
$excerpt_length = apply_filters( 'excerpt_length', 55 );
改为,
$excerpt_length = apply_filters( 'excerpt_length', 100 );