FrameMarket Child Theme - Enqueue Scripts vs. @include?

I noticed that the WP codex suggests using enqueue scripts instead of the @include for the parent theme. http://codex.wordpress.org/Child_Themes

Does WPMU Dev recommend this approach with the FrameMarket Theme?

If so, does this look correct to add to the functions.php?

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

}

  • Vaughan

    Hi Jamie,

    Hope you're well?

    Either approach should work fine.

    However, Framemarket comes with it's own child-theme which you can find in the themes folder of the framemarket theme.

    In the gridmarket theme functions.php, it looks like

    function framemarket_enqueue_styles(){
    	$version = '1.4';
    
    	global $bp_existed;
    
    	if ( (!is_admin()) && ($bp_existed == 'true') ) {
    		wp_enqueue_style( 'buddypress-default', get_template_directory_uri() . '/buddypress/bp-default.css', array( 'framemarket' ), $version);
    	}
    
    	if ( !is_admin() ) {
    		wp_enqueue_style( 'framemarket', get_template_directory_uri() . '/css/framemarket.css', array(), $version);
    
    		wp_enqueue_style( 'gridmarket', get_stylesheet_directory_uri() . '/css/grid.css', array( 'framemarket' ), $version);
    
    				$themename = wp_get_theme();
    				$themeinput = $themename . '_styleinput';
    
    				$options = get_option('framemarket_theme_options');
    				$stylesheet = isset($options[$themeinput]) ? $options[$themeinput] : '';
    
    				if ($stylesheet != ""){
    					wp_enqueue_style( 'gridmarket_style', get_stylesheet_directory_uri() .  '/styles/' . $stylesheet . '.css', array( 'framemarket' ), $version);
    
    				}
    				else{
    				wp_enqueue_style( 'gridmarket_orange', get_stylesheet_directory_uri() . '/styles/darkorange.css', array( 'framemarket' ), $version);
    				}
    
    				wp_enqueue_style( 'gridmarket_custom', get_stylesheet_directory_uri() . '/css/custom.css', array( 'framemarket' ), $version);
    			 }
    
    }

    As you can see, it might be best to use framemarket instead of parent-style.

    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
    wp_enqueue_style( 'framemarket', get_template_directory_uri() . '/css/framemarket.css' );
    
    }

    Hope this helps

  • Bojan Radonic

    Hey there @jamie,

    In order to use framemarket already created child theme you have to move it from:

    wp-content/themes/framemarket/themes/gridmarket

    to wp-content/themes/gridmarket

    Once placed there gridmarket child theme will be available in Network Admin >> Themes. You'll have to network activate it in order for it to be displayed as available on subsites.

    Hope this helps :slight_smile:

    Best regards,
    Bojan

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.