我有点腌,哈哈。
这是我的功能:
function start_group_escapes_4_less() {
wp_enqueue_style( 'style', get_stylesheet_uri() . '/style.css');
wp_enqueue_script( 'ge4l', get_stylesheet_uri() . '/js/ge4l.js', array('jquery'), null, true);
}
add_action( 'wp_enqueue_scripts', 'start_group_escapes_4_less' );
我检查的每个地方,语法都是正确的。或者是吗? 帮助:(
答案 0 :(得分:2)
函数get_stylesheet_uri()
返回主题style.css文件的URL。
您需要使用get_stylesheet_directory_uri()
function start_group_escapes_4_less() {
wp_enqueue_style( 'style', get_stylesheet_directory_uri() . '/style.css');
wp_enqueue_script( 'ge4l', get_stylesheet_directory_uri() . '/js/ge4l.js', array('jquery'), null, true);
}
add_action( 'wp_enqueue_scripts', 'start_group_escapes_4_less' );
答案 1 :(得分:0)
确保文件style.css
和ge4l.js
的目录正确且适用于wp-admin文件。或者尝试在代码中显示的目录中添加〜符号。
答案 2 :(得分:0)
检查return =&gt;的值<?php echo get_stylesheet_uri(); ?>
使用get_template_directory()
?!