<?php

add_action('wp_enqueue_scripts', 'garajez_customize_logo', 20);
add_action('wp_enqueue_scripts', 'garajez_customize_header_background', 20);

function garajez_customize_logo(){
    $logo_css = '';
    $margins = array(
        'margin-top',
        'margin-left'
       );

    foreach($margins as $margin){
        $tmp_key = "logo-{$margin}";
        $tmp_value = (int) get_theme_mod($tmp_key);
        if( $tmp_value ){
            $logo_css .= "{$margin} : {$tmp_value}px; ";
        }
    }

    if( !empty($logo_css) ){
        $logo_css = ".logo-image {{$logo_css}}";
        wp_add_inline_style(KOPA_PREFIX . 'style', $logo_css);
    }

}

function garajez_customize_header_background(){
    $header_bg = get_header_image();
    if( !empty($header_bg) ){
        $header_bg_css = ".kopa-header{background: url({$header_bg});}";
        wp_add_inline_style(KOPA_PREFIX . 'style', $header_bg_css);
    }

}


