phgDigital / Project

1 stars 1 forks source link

How do we handle color/white logo? #21

Closed chrisblakley closed 7 years ago

chrisblakley commented 7 years ago

How will we detect when we need a white version of the logo vs. when to use the full color version? How will we get the white version? Expect an SVG or have a 2nd logo upload? Ideally we'd avoid bloat here.

screen shot 2017-07-19 at 12 27 28 pm

How to other themes do this?

chrisblakley commented 7 years ago

I'm thinking we need an image upload for a "One-Color Logo" (and use "typically white") in the description under Site Identity, and then a checkbox on both the Home > Hero and Posts > Header for "Use one-color logo".

chrisblakley commented 7 years ago

Here's what I did:

<?php
    $logo = get_theme_file_uri('/assets/img/logo.svg');
    if ( get_theme_mod('custom_logo') ){ //If the Customizer logo exists
        $logo = nebula()->get_thumbnail_src(get_theme_mod('custom_logo'));
        if ( get_theme_mod('one_color_logo') ){ //If the one-color logo exists
            if ( (is_front_page() && get_theme_mod('nebula_hero_single_color_logo')) || (!is_front_page() && get_theme_mod('nebula_header_single_color_logo')) ){ //If it is the frontpage and the home one-color logo is requested -OR- if it is a subpage and the header one-color logo is requested
                $logo = get_theme_mod('one_color_logo');
            }
        }
    }
?>
<img class="svg" src="<?php echo $logo; ?>" alt="<?php bloginfo('name'); ?>"/>