html - wp_enqueue_style 的行为与记录不符

标签 html css wordpress wordpress-theming

我在驱动程序中写了以下内容:

 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/

相关文章:

css - 使用 simple_form_for 给表单一个 CSS 类

javascript - 处理 WooCommerce 选定的变体自定义字段条件显示

php - 多个帖子页面的 If 语句 - 显示/隐藏 - Wordpress

css - 使网页适合浏览器

html - 使用 CSS3 的图像上的绝对位置文本在 Safari 上不起作用

css - 使用 CSS,有没有办法改变 SVG 的 <filter> 元素的不透明度?

javascript - WordPress 的各个版本之间存在哪些独特的帖子引用?

html - HTML 5 地理定位如何工作?

html - CSS:如何使图像适合底部被剪裁但顶部弹出的圆圈?

html - 如何在 IE 中删除选择选项时的白色背景