Skip to content

Instantly share code, notes, and snippets.

@vanaf1979
Last active October 20, 2019 10:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanaf1979/44336efe0a2cfccc924474c4feb4fa3b to your computer and use it in GitHub Desktop.
Save vanaf1979/44336efe0a2cfccc924474c4feb4fa3b to your computer and use it in GitHub Desktop.
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