我有一个子主题和一个非常空的函数。php。子主题提取来自父主题的CSS,but the whole JS section from the parent theme is not rendered in the DOM at all. (我对WP dev很陌生)。我错过什么了吗?我做错了什么?
这是我的子主题的基本文件结构:
/themes
/main-theme
/main-theme-child
/js
custom_script.js
functions.php
screenshot.png
style.css
我通过插件(子主题配置器)创建了子主题功能。php
<?php
// Exit if accessed directly
if ( !defined( \'ABSPATH\' ) ) exit;
// BEGIN ENQUEUE PARENT ACTION
// AUTO GENERATED - Do not modify or remove comment markers above or below:
if ( !function_exists( \'chld_thm_cfg_locale_css\' ) ):
function chld_thm_cfg_locale_css( $uri ){
if ( empty( $uri ) && is_rtl() && file_exists( get_template_directory() . \'/rtl.css\' ) )
$uri = get_template_directory_uri() . \'/rtl.css\';
return $uri;
}
endif;
add_filter( \'locale_stylesheet_uri\', \'chld_thm_cfg_locale_css\' );
if ( !function_exists( \'chld_thm_cfg_parent_css\' ) ):
function chld_thm_cfg_parent_css() {
wp_enqueue_style( \'chld_thm_cfg_parent\', trailingslashit( get_template_directory_uri() ) . \'style.css\', array( \'bootstrap\',\'font-awesome\',\'flaticon\',\'animate\',\'hover\',\'owl-theme\',\'jquery-ui\',\'fancybox\' ) );
}
endif;
add_action( \'wp_enqueue_scripts\', \'chld_thm_cfg_parent_css\', 10 );
// END ENQUEUE PARENT ACTION
function custom_enqueue_scripts() {
wp_enqueue_script( \'consultox-main-script\', get_stylesheet_directory_uri().\'/js/custom_script.js\', array(), false, true );
}
add_action( \'wp_enqueue_scripts\', \'custom_enqueue_scripts\' );
- How get I all the basic functionality of the parent theme working?
- How can I get my custom javascript loaded?
提前非常感谢!