• Resolved mniggemann

    (@mniggemann)


    Ups, one minor thing I was stumbling over, when I adjust the colors in customizer, they will be available in the Gutenberg blocks, in the backend. However, on the site the colors from the default color palette will be used instead.

    I’m usind a child theme, would that make any difference in this respect?

    Best!
    -martin

Viewing 4 replies - 1 through 4 (of 4 total)
  • Theme Author Anders Norén

    (@anlino)

    Hi @mniggemann,

    I tested this in my local development environment just now, with a child theme active, and the colors set in the Customizer showed in both the front-end and in the editor styles.

    The CSS for the front-end colors (and other style settings) are appended as inline styles to the stylesheet enqueued with the chaplin-style handle, so if you’re modifying the enqueues in your child theme, that might be causing it.

    – Anders

    Thread Starter mniggemann

    (@mniggemann)

    Hi Anders,
    Thanx for the quick reply! Right now I am using

    function child_theme_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-theme-css', get_stylesheet_directory_uri() .'/style.css' , array('parent-style'));
    }
    add_action( 'wp_enqueue_scripts', 'child_theme_styles', 12 );

    Should I change the sequence?
    Apart from that, I only modified $css_dependencies by leaving the Google fonts out.

    Cheers!
    -M

    Theme Author Anders Norén

    (@anlino)

    Hi @mniggemann,

    No problem! Yes, by enqueueing the parent stylesheet using a different handle, I believe WordPress will automatically remove chaplin-style from the queue, resulting in the inline style not being loaded (since the enqueue handle it’s attached to no longer exists).

    I’d recommend using this instead:

    function chaplin_child_register_styles() {
    	$theme_version = wp_get_theme( 'chaplin-child' )->get( 'Version' );
    	wp_enqueue_style( 'chaplin-child-style', get_stylesheet_uri(), array(), $theme_version );
    }
    add_action( 'wp_enqueue_scripts', 'chaplin_child_register_styles', 20 );

    Since the priority (20) is higher than the priority of the function Chaplin uses for enqueues (10), your child theme styles will be loaded after the parent styles so the parent theme styles are easy to overwrite.

    If you go this route, you’ll have to add separate function hooked to the chaplin_css_dependencies filter to remove the Google Fonts enqueue, though.

    – Anders

    Thread Starter mniggemann

    (@mniggemann)

    Hej Anders,
    works like a charm, perfect!

    The Google fonts remain removed, as far as I can see, with

    function mh_filter_css_dependencies( $css_dependencies ) {
    	$key = array_search( 'chaplin-google-fonts', $css_dependencies );
    	if ( $key !== false ) {
    		unset( $css_dependencies[$key] );
    	}
    	return $css_dependencies;
    }
    add_filter( 'chaplin_css_dependencies', 'mh_filter_css_dependencies' );
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom colors in customizer are overwritten by default color palette in frontend’ is closed to new replies.