Last active
August 29, 2015 14:01
-
-
Save designbuildtest/b140e21180348df4c5c0 to your computer and use it in GitHub Desktop.
Customizer logo function
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
<?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