Child theme header backround

This support request was posted in Flatbase by LottaC

Request ID #6908 Resolved
  • I installed child theme, however I cant change header bg color. I have done this in parent and child theme settings, if I activate parent, then color is ok, but if I activate child, it restores back to default. Other settings like logo seem to be ok.

    Already tried to deactivate/activate plugins and themes.

    Here’s the css in console (#00354d is the color I want).

    media=”all”
    #header {
    min-height: 120px;
    background: #35a49e; // this is shown
    }

    #header {
    background-color: #00354d;
    }

    Hi LottaC,

    Thanks for reaching us.

    As far as I could test here, it seems to depend on how you load the stylesheets in your child theme. Testing in our local environment, I’m doing it with only the following two files:

    style.css

    /*
     Theme Name: Test Child Theme
     Author: NiceThemes
     Template: flatbase
    */
    

    functions.php

    < ?php
    
    if ( ! function_exists( 'test_child_theme_enqueue_styles' ) ) :
    add_action( 'wp_enqueue_scripts', 'test_child_theme_enqueue_styles', 0 );
    /**
     * Enqueue parent and child theme styles.
     */
    function test_child_theme_enqueue_styles() {
    
    	$parent_style = 'parent-style';
    
    	wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    	wp_enqueue_style( 'child-style',
    		get_stylesheet_directory_uri() . '/style.css',
    		array( $parent_style )
    	);
    }
    endif;
    

    Note that the function is hooked with a priority of zero. This way the styles defined in the options (which are added inline) will be processed later, and will override the default styles properly.

    Please let me know if this method works for you, and if I can be of further assistance.

    Best,

    Ricardo

    This solved the issue, thank you! 🙂

    Great! Please contact us again if you run into any other issues.

    Ricardo

Viewing 4 posts - 1 through 4 (of 4 total)

This topic is marked as resolved

Only the topic author can re-open this thread.

Login to your Account

Welcome back! Please log in to your account by filling the fields below:

Forgot?

Not a member? Create a free account.

Create a Free Account

You're 27 seconds away from some awesome WordPress free stuff, benefits and more. Create a free account and have access to our free products, benefits and more!

Already have an account? Log in
Secure Server