Skip to content

Instantly share code, notes, and snippets.

@designbuildtest
Last active August 29, 2015 14:01
Show Gist options
  • Save designbuildtest/b140e21180348df4c5c0 to your computer and use it in GitHub Desktop.
Save designbuildtest/b140e21180348df4c5c0 to your computer and use it in GitHub Desktop.
Customizer logo function
<?php
/**
* Custom site logo function.
*
* Check if a site logo has been uploaded. If a site logo is present, query the database to retrieve
* the medium sized version of the image. This function prevents excessively large logo images being
* displayed on the frontend.
*/
function twentyfourteen_site_logo() {
$site_logo = get_theme_mod( 'site_logo' );
if ( $site_logo ) {
global $wpdb;
$logo_query = "SELECT ID FROM {$wpdb->posts} WHERE guid='{$site_logo}'";
$logo_id = $wpdb->get_var($logo_query);
$logo = wp_get_attachment_image_src( $logo_id,'medium' );
return $logo[0];
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment