WP Customizer on a webserver not changing the CSS

I created my own theme in WordPress in which users are able to set a custom background-color.

When running locally on XAMPP, I have no problem, but when I upload the theme to a web server the background color disappears. When I go into the Customizer tab the background color is correct. The WordPress on the webserver is a fresh install.

Read More

It seems like this line is responsible for the missing color:

<?php echo get_theme_mod('info_bg_color'); ?>

How it looks on a webserver where the header and footer should be green.
(Picture)

When I open the customizer tab the colors are correct.
(Picture)

This is just a part of the code.

Please contact me for the full site.

Can anyone help me?

/*
================================
 Customize Appearance Options
================================
*/
function info_customize_register( $wp_customize ){
    // Add setting
    $wp_customize->add_setting('info_txt_color', array(
        'default'   => '#FFF',
        'transport' => 'refresh',
    ));

    $wp_customize->add_setting('info_bg_color', array(
        'default'   => '#287e43',
        'transport' => 'refresh',
    ));

    $wp_customize->add_setting('info_border_color', array(
        'default'   => '#ba2e25',
        'transport' => 'refresh',
    ));

    $wp_customize->add_setting( 'info_logo' );

    $wp_customize->add_setting('text_setting', array(
        'default'   => 'Logo',
    ));

    // Add section
    $wp_customize->add_section('info_colors',array(
        'title'     => __('Farver','info'),
        'priority'  => 30,
    ));

    $wp_customize->add_section('info_header_logo',array(
        'title'         => __('Logo','info'),
        'priority'      => 30,
        'description'   => 'Upload et logo som vil erstatte "Logo" teksten i din header',
    ));

    $wp_customize->add_section('footer_settings_section', array(
        'title' => 'Footer Text Section'
    ));

    // Add control
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'info_txt_color_control', array(
        'label'     => __('Tekst Farve','info'),
        'section'   => 'info_colors',
        'settings'  => 'info_txt_color',
    )));

    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'info_bg_color_control', array(
        'label'     => __('Baggrunds Farve','info'),
        'section'   => 'info_colors',
        'settings'  => 'info_bg_color',
    )));

    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'info_border_color_control', array(
        'label'     => __('Border Farve','info'),
        'section'   => 'info_colors',
        'settings'  => 'info_border_color',
    )));

    $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'info_logo_control', array(
        'label'     => __( 'Logo', 'info' ),
        'section'   => 'info_header_logo',
        'settings'  => 'info_logo',
    )));

    $wp_customize->add_control('text_setting', array(
        'label'     => 'Logo Tekst',
        'section'   => 'info_header_logo',
        'type'      => 'textarea',
    ));
}

add_action( 'customize_register' , 'info_customize_register' );

/*
================================
 Customize Appearance Options
================================
*/

function info_customize_css() { ?>
    <style type="text/css">
        header p, #digital-time {
            color: <?php echo get_theme_mod('info_txt_color'); ?>;
        }
        header {
            background-color: <?php echo get_theme_mod('info_bg_color'); ?>;
            border-bottom: 4px solid <?php echo get_theme_mod('info_border_color'); ?>;
        }
        footer {
            background-color: <?php echo get_theme_mod('info_bg_color'); ?>;
            border-top: 4px solid <?php echo get_theme_mod('info_border_color'); ?>;
        }
    </style>
<?php }

add_action( 'wp_head' , 'info_customize_css' );

Related posts