Child theme issue
-
My site uses a theme from Pego named Clearix. My attempts to use a child theme based on it have been unsuccessful.
I’m attempting to use the method recommended in the Codex: “The correct method of enqueuing the parent theme stylesheet is to use wp_enqueue_script() in your child theme’s functions.php.”
For reference, here’s how Pego enques their parent stylesheet styles.css (you’ll see that other stylesheets are used in this theme but this main one is the only one I need to overrule) …
function pego_theme_styles() { global $pego_prefix; wp_enqueue_style( 'flexslider-style', get_template_directory_uri() . '/css/flexslider.css', array(), '1.0', 'all' ); wp_enqueue_style( 'widgets-style', get_template_directory_uri() . '/css/widgets.css', array(), '1.0', 'all' ); wp_enqueue_style( 'icons-style', get_template_directory_uri() . '/css/icons.css', array(), '1.0', 'all' ); wp_enqueue_style( 'default-style', get_template_directory_uri() . '/style.css', array(), '1.0', 'all' ); if ( is_admin() ) { wp_enqueue_style('admin-style', get_template_directory_uri() .'/css/admin-style.css', false, '1.0', 'all'); } if ( function_exists( 'ot_get_option' ) ) { if (ot_get_option('clearix_layout_type') == 'boxed') { wp_enqueue_style( 'boxed-style', get_template_directory_uri() . '/css/boxed.css', array(), '1.0', 'all' ); } } wp_enqueue_style( 'media-style', get_template_directory_uri() . '/css/media.css', array(), '1.0', 'all' ); } add_action('wp_enqueue_scripts', 'pego_theme_styles');
… and here’s the code I’m using in my child theme’s functions.php:
function theme_enqueue_styles() { wp_enqueue_style( 'default-style', get_template_directory_uri() . '/style.css', array(), '1.0', 'all' ); } add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
Also for reference, here’s the top of my child’s styles.css:
/* Theme Name: Clearix Child Theme URI: https://staging.parkhillvet.com/wp-content/themes/clearix-child/ Description: Clearix Child Theme Author: Andy Campbell Creative Author URI: andycampbellcreative [at] gmail [dot] com Template: clearix Version: 1.2 License: GNU General Public License v2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html */
That “Template” line features “clearix” — that is exactly how the parent theme’s file directory is named.
What am I doing wrong here? Apologies if this information may be found somewhere on the Codex — I searched and couldn’t find anything that helped — or if I’ve left any information out.
My site may be found at https://staging.parkhillvet.com. It’s currently using the parent theme until I lick this issue; let me know if it needs to be set to the child in order to diagnose this issue.
Thanks in advance for any time spent diagnosing this.
- The topic ‘Child theme issue’ is closed to new replies.