Last active
May 15, 2020 18:01
-
-
Save ibndawood/3680071d03b5f1f1b5f49eaa6459fec6 to your computer and use it in GitHub Desktop.
Vodi - Remove linking in navbar-brand logo in Header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function vodi_header_logo() { | |
?><div class="site-header__logo"><?php | |
if ( has_custom_logo() ) { | |
$html = ''; | |
$custom_logo_id = get_theme_mod( 'custom_logo' ); | |
if ( $custom_logo_id ) { | |
$custom_logo_attr = array( | |
'class' => 'custom-logo', | |
); | |
/* | |
* If the logo alt attribute is empty, get the site title and explicitly | |
* pass it to the attributes used by wp_get_attachment_image(). | |
*/ | |
$image_alt = get_post_meta( $custom_logo_id, '_wp_attachment_image_alt', true ); | |
if ( empty( $image_alt ) ) { | |
$custom_logo_attr['alt'] = get_bloginfo( 'name', 'display' ); | |
} | |
/* | |
* If the alt attribute is not empty, there's no need to explicitly pass | |
* it because wp_get_attachment_image() already adds the alt attribute. | |
*/ | |
$html = sprintf( | |
'<div class="custom-logo-link">%2$s</div>', | |
esc_url( home_url( '/' ) ), | |
wp_get_attachment_image( $custom_logo_id, 'full', false, $custom_logo_attr ) | |
); | |
} elseif ( is_customize_preview() ) { | |
// If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview). | |
$html = sprintf( | |
'<div class="custom-logo-link" style="display:none;"><img class="custom-logo"/></div>', | |
esc_url( home_url( '/' ) ) | |
); | |
} | |
echo wp_kses_post( $html ); | |
} elseif ( apply_filters( 'vodi_use_svg_logo', false ) ) { | |
?><div class="navbar-brand"><?php vodi_get_template( 'global/logo-svg.php' ); ?></div><?php | |
} else { | |
?><div class="navbar-brand"><h1 class="site-title"><?php bloginfo( 'name' ); ?></h1></div><?php | |
} | |
?></div><?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment