关于博客网页打开速度慢

发布于 2021-11-02  364 次阅读


原因:外部引用css加载超时

解决方法:进不去网站。。。所以注释掉。。

css位置:

1:/www/wwwroot/blog.rzhylj.com/wp-content/themes/Sakurairo/header.php-----------31

<link rel="stylesheet" href="https://<?php echo iro_opt('google_fonts_api'); ?>/css?family=Noto+SerifMerriweather|Merriweather+Sans|Source+Code+Pro|Ubuntu:400,700|Noto+Serif+SC<?php echo iro_opt('google_fonts_add'); ?>" media="all">

2:/www/wwwroot/blog.rzhylj.com/wp-content/themes/Sakurairo/header.php-----------71

<link rel="shortcut icon" href="<?php echo iro_opt('favicon_link', ''); ?>" />

3:/www/wwwroot/blog.rzhylj.com/wp-content/themes/Sakurairo/footer.php-----------168

<link rel="stylesheet" href="<?php echo $mashiro_logo['font_link']; ?>" media="all">

........最后发现好像在/www/wwwroot/blog.rzhylj.com/wp-content/themes/Sakurairo/functions.php-----------1457-1481

function custom_admin_open_sans_font()
{
    echo '<link href="https://' . iro_opt('google_fonts_api') .'/css?family=Merriweather+Sans|Noto+Serif+SC&display=swap" rel="stylesheet">' . PHP_EOL;
    echo '<style>body, #wpadminbar *:not([class="ab-icon"]), .wp-core-ui, .media-menu, .media-frame *, .media-modal *{font-family:"Noto Serif SC","Source Han Serif SC","Source Han Serif","source-han-serif-sc","PT Serif","SongTi SC","MicroSoft Yahei",Georgia,serif !important;}</style>' . PHP_EOL;
}
add_action('admin_head', 'custom_admin_open_sans_font');

// WordPress Custom Font @ Admin Frontend Toolbar
function custom_admin_open_sans_font_frontend_toolbar()
{
    if (current_user_can('administrator')) {
        echo '<link href="https://' . iro_opt('google_fonts_api') .'/css?family=Merriweather+Sans&display=swap" rel="stylesheet">' . PHP_EOL;
        echo '<style>#wpadminbar *:not([class="ab-icon"]){font-family:"Noto Serif SC","Source Han Serif SC","Source Han Serif","source-han-serif-sc","PT Serif","SongTi SC","MicroSoft Yahei",Georgia,serif !important;}</style>' . PHP_EOL;
    }
}
add_action('wp_head', 'custom_admin_open_sans_font_frontend_toolbar');

// WordPress Custom Font @ Admin Login
function custom_admin_open_sans_font_login_page()
{
    if (stripos($_SERVER["SCRIPT_NAME"], strrchr(wp_login_url(), '/')) !== false) {
        echo '<link href="https://' . iro_opt('google_fonts_api') .'/css?family=Noto+Serif+SC&display=swap" rel="stylesheet">' . PHP_EOL;
        echo '<style>body{font-family:"Noto Serif SC","Source Han Serif SC","Source Han Serif","source-han-serif-sc","PT Serif","SongTi SC","MicroSoft Yahei",Georgia,serif !important;}</style>' . PHP_EOL;
    }
}

结语:快多了

更新:发现只要在/www/wwwroot/blog.rzhylj.com/wp-content/themes/Sakurairo/functions.php-----------1457-1481代码中的三个

echo '<link href="https://' . iro_opt('google_fonts_api') .'/css?family=Noto+Serif+SC&display=swap" rel="stylesheet">' . PHP_EOL;

删掉就可以了。。。


小叶,嘿嘿嘿,喜欢你,嘿嘿嘿。。。