Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gist for my article: WordPress: Add custom logo support to your theme. https://vanaf1979.nl/wordpress-add-custom-logo-support-to-your-theme/
<?php
function theme_get_custom_logo() {
if ( has_custom_logo() ) {
$logo = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ) , 'full' );
echo '<a class="custom-logo-link" href="' . get_site_url() . '" >';
echo '<img class="custom-logo" src="' . esc_url( $logo[0] ) . '" width="' . $logo[1] . '" height="' . $logo[2] . '" alt="' . get_bloginfo( 'name' ) . '">';
echo "</a>";
} else {
echo '<h1>';
echo '<a href="' . get_site_url() . '">' . get_bloginfo( 'name' ) . '</a>';
echo '</h1>';
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.