内容纲要
关于 WordPress 开启强制 Https 访问后 WordPress后台页面出现错乱的问题
问题页面展示
即后台网站页面样式错乱,f12爆许多css加载错误。
解决方案
1.打开网站根目录文件\wp-includes\functions.php
,找到下面的代码。
require( ABSPATH . WPINC . '/option.php' );
在其下面添加以下代码段。
add_filter('script_loader_src', 'agnostic_script_loader_src', 20,2); function agnostic_script_loader_src($src, $handle) { return preg_replace('/^(http|https):/', '', $src); }
add_filter('style_loader_src', 'agnostic_style_loader_src', 20,2); function agnostic_style_loader_src($src, $handle) { return preg_replace('/^(http|https):/', '', $src); }
2.打开网站根目录\wp-config.php文件,在文件中添加以下代码段。
*
* @package WordPress
*/
$_SERVER['HTTPS'] = 'on';
define('FORCE_SSL_LOGIN', true);
define('FORCE_SSL_ADMIN', true);
完成以上两步操作后,即可正常访问网站后台了,登录 WordPress 后台。
注意:网页使用 ctrl+f5 刷新缓存,否则可能无法生效。
3.打开 WordPress 后台设置网站站点地址。如下图设置。
马赛克位置为网站地址。
至此问题解决。
Argon主题将网站的浮动按钮向上调整绝对位置的问题
将网站的浮动按钮和其面板向上调整位置使其避开下方的音乐播放窗口。效果如图:
解决方案
在网站的 额外CSS 中添加以下代码。
/*浮动按钮栏 (回顶等)*/
#float_action_buttons {
position: fixed;
bottom: 100px; //向上移动的像素
right: 20px;
height: max-content;
height: -moz-max-content;
z-index: 1000;
transition: all 0.3s ease;
}
/*浮动按钮栏二层*/
#fabtn_blog_settings_popup {
position: fixed;
right: 85px;
bottom: 100px; //向上移动的像素
padding: 10px 25px;
opacity: 0;
width: max-content;
width: -moz-max-content;
min-width: 350px;
max-width: calc(100vw - 170px);
max-height: calc(100vh - 70px);
pointer-events: none;
transform: translateX(10px);
transition: all 0.3s ease;
animation: none !important;
}
保存刷新页面后浮动按钮成功向上移动。