gpt4 book ai didi

ios - Wordpress 自定义 css 无法在 iOS 上加载

转载 作者:太空宇宙 更新时间:2023-11-04 00:58:35 25 4
gpt4 key购买 nike

我尝试自定义子主题的 css。

如果我修改子主题的style.css,它会在iOS设备上被注释掉。然后我尝试加入一个新的样式表,结果是这个样式表根本没有出现在 head 部分(总是在 iOS 上,桌面版本就像一个魅力)。

这是我对样式表进行排队的代码:

function wp_enqueue_styles() {
$handle = 'custom_style';
$path = get_stylesheet_directory_uri() . '/css/';
$directory = get_stylesheet_directory() . '/css/';
$dependencies = [];
$version = '1.0';

$filename = 'main.css';
$filename_min = 'main.min.css';

if ( file_exists( $directory . $filename_min ) ) {
wp_register_style( $handle, $path . $filename_min );
wp_enqueue_style( $handle, $path . $filename_min, $dependencies, $version );
} else if ( file_exists( $directory . $filename ) ) {
// override version with file changed time to bypass cache problems
wp_register_style( $handle, $path . $filename );
wp_enqueue_style( $handle, $path . $filename, $dependencies, $version );
}
}

有什么想法吗?

最佳答案

试试看

function theme_name_scripts() {
// Remove a CSS file (main theme)
wp_deregister_style( 'Script_name_id' );
// Add New a CSS file ( child theme )
wp_enqueue_style( 'Script_name_id', get_template_directory_uri() . 'Script_path',[],null);
}
add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );

关于ios - Wordpress 自定义 css 无法在 iOS 上加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54008659/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com