Scherzo child themes won't register functions.php scripts
-
Hi there,
I’ve created a theme called Scherzo.
I’m planning to release a new version but one thing is holding me up.
I’ve created a responsive design that targets desktop browsers with
@media
CSS queries. As IE doesn’t understand@media
queries I use some javascript to get IE to do my bidding.The js is stored in a folder entitled
js
in the theme folder. It works just fine with the Scherzo theme but, for some reason, child themes don’t seem to load it.This is how I register and enqueue the js in Scherzo’s
functions.php
:if ( !function_exists( 'scherzo_scripts' ) ) : function scherzo_scripts() { if (!is_admin()) { wp_register_script( 'html5shiv', get_template_directory_uri() . '/js/html5.js'); wp_register_script( 'css3mediaqueries', get_template_directory_uri() . '/js/css3-mediaqueries.js'); wp_enqueue_script('html5shiv'); wp_enqueue_script('css3mediaqueries'); } } add_action('init', 'scherzo_scripts'); endif;
My understanding of child themes is that they simply inherit the parent theme’s
functions.php
functions. But this doesn’t seem to be the case. For examples, see:A site running Scherzo
A site running a child theme of Scherzo (the only change is the link colours — no layout changes or anything else).If you load both sites in IE you’ll see the child theme isn’t obeying
@media queries
— it’s just using the one column CSS.TIA,
Leon
- The topic ‘Scherzo child themes won't register functions.php scripts’ is closed to new replies.