我在驱动程序中写了以下内容:
add_action( 'wp_enqueue_scripts', 'add_css_file' );
function add_css_file()
{
// Tried this prior:
// $path = ABSPATH . "/wp-content/plugins/this_plugin/css/";
// wp_register_style( 'css_file', $path.'css_file.css' );
wp_register_style( 'css_file', 'http://subdomain.mysite.com/wp-content/plugins/this_plugin/css/css_file.css' );
wp_enqueue_style( 'css_file' );
}
字符串“css_file”没有出现在View Source HTML中,其中定义的CSS规则不生效。
最佳答案
你有没有包括wp_head()
在<head>
你的页面? wp_head()
会将您排队的样式和脚本添加到页面。
关于html - wp_enqueue_style 的行为与记录不符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26427482/