WordPress 子主题 JavaScript 文件未加载
WordPress Child Theme JavaScript File Not Loading
请检查以下代码并告诉我为什么 CUSTOM-SCRIPT.JS 文件没有加载。 CUSTOM-STYLES.CSS 正在加载,但脚本文件没有。我指的代码在底部 FUNCTION CUSTOM_STYLES() 但我认为上面的代码一定很重要。
<?php
function bean_feature_setup()
{
$args = array(
'primary' => array(
'adminstyles' => true,
'customizer' => true,
'meta' => true,
'seo' => true,
'widgets' => true,
'widgetareas' => true,
'whitelabel' => false,
'updates' => false,
),
'plugins' => array(
'notice' => true,
'portfolio' => true,
'shortcodes' => true,
'twitter' => true,
'instagram' => true,
'social' => true,
'pricingtables' => true,
),
'comments' => array(
'pages' => false,
'portfolio' => false,
'posts' => true,
),
'debug' => array(
'footer' => false,
'queries' => false,
),
);
return apply_filters( 'bean_theme_config_args', $args );
}
add_action('bean_init', 'bean_feature_setup');
?>
<?php
function custom_styles() {
wp_enqueue_style('custom_style', get_stylesheet_directory_uri().'/custom-styles.css', array(),'', false);
wp_enqueue_script('custom-script', get_stylesheet_directory_uri().'/custom-script.js', array('jQuery'),'', false);
}
add_action('wp_enqueue_scripts','custom_styles');
?>
将jQuery
更改为jquery
wp_enqueue_script('custom-script', get_stylesheet_directory_uri().'/custom-script.js', array('jquery'),'', false);
请检查以下代码并告诉我为什么 CUSTOM-SCRIPT.JS 文件没有加载。 CUSTOM-STYLES.CSS 正在加载,但脚本文件没有。我指的代码在底部 FUNCTION CUSTOM_STYLES() 但我认为上面的代码一定很重要。
<?php
function bean_feature_setup()
{
$args = array(
'primary' => array(
'adminstyles' => true,
'customizer' => true,
'meta' => true,
'seo' => true,
'widgets' => true,
'widgetareas' => true,
'whitelabel' => false,
'updates' => false,
),
'plugins' => array(
'notice' => true,
'portfolio' => true,
'shortcodes' => true,
'twitter' => true,
'instagram' => true,
'social' => true,
'pricingtables' => true,
),
'comments' => array(
'pages' => false,
'portfolio' => false,
'posts' => true,
),
'debug' => array(
'footer' => false,
'queries' => false,
),
);
return apply_filters( 'bean_theme_config_args', $args );
}
add_action('bean_init', 'bean_feature_setup');
?>
<?php
function custom_styles() {
wp_enqueue_style('custom_style', get_stylesheet_directory_uri().'/custom-styles.css', array(),'', false);
wp_enqueue_script('custom-script', get_stylesheet_directory_uri().'/custom-script.js', array('jQuery'),'', false);
}
add_action('wp_enqueue_scripts','custom_styles');
?>
将jQuery
更改为jquery
wp_enqueue_script('custom-script', get_stylesheet_directory_uri().'/custom-script.js', array('jquery'),'', false);