• I would like to offer this modification to the core function.php file for the Hemingway Theme. Doing so would eliminate the need to write extra code in the child theme’s function.php to load the child theme’s style sheet after the parent theme is loaded.

    Under the ENQUEUE STYLES section, replace this:

    wp_enqueue_style( 'hemingway_style', get_template_directory_uri() . '/style.css', $dependencies, $theme_version );
    
    With this:
    
    		if ( is_child_theme() ) {
    			wp_enqueue_style( 'hemingway_style', get_template_directory_uri() . '/style.css', $dependencies, $theme_version );
    		}
    		/* Always load active theme's style.css */
    		wp_enqueue_style( 'style', get_stylesheet_uri() );

    This code will check for a child theme and if found, will load the parent style.css file first and load the child theme’s style.css second.

    I must give credit for this idea to Justin Tadlock
    https://justintadlock.com/archives/2014/11/03/loading-parent-styles-for-child-themes

    • This topic was modified 3 years, 7 months ago by kwbrayton.
    • This topic was modified 3 years, 7 months ago by kwbrayton.
  • The topic ‘Loading Child Theme Styles’ is closed to new replies.