Hi all,
I’m still new to WordPress and Enfold, and was just looking at the suggested, pre-built enfold-child files.
The WordPress Codex says:
The correct method of enqueuing the parent theme stylesheet is to use wp_enqueue_script() in your child theme’s functions.php.
However, the functions.php in enfold-child is essentially empty. Why is that? Shouldn’t we call wp_enqueue_script() as suggested in the Codex?
Hey CarstenF!
Child theme inherits files from parent theme as long as you do not overwrite them. You can use Style.css file of your child theme to add custom CSS codes. If you would like to overwrite files such as Avia.js file, you can add following code to Functions.php file of your child theme
function wp_change_aviajs() {
wp_dequeue_script( 'avia-default' );
wp_enqueue_script( 'avia-default-child', get_stylesheet_directory_uri().'/js/avia.js', array('jquery'), 2, true );
}
add_action( 'wp_print_scripts', 'wp_change_aviajs', 100 );
please also see – http://kriesi.at/documentation/enfold/add-new-or-replace-advanced-layout-builder-elements-from-child-theme/
Best regards,
Yigit
Hi Yigit,
thanks for your reply!
I think what initially confused me is the fact that the parent’s enfold/style.css does not actually contain any CSS rules. Besides the header and comments, the file is empty.
Only this fact lets enfold-child theme get away without either using @import or wp_enqueue_script() !
This was the reason for my original question above: I only realized this fact later.
Therefore, could you please add a clarifying comment to the style.css in http://bit.ly/enfold-child that says, for example:
“The Enfold parent theme’s style.css does not contain any CSS rules, and thus there is no need to account for it here by using @import or wp_enqueue_script()”
Best regards,
Carsten