Skip to content

Instantly share code, notes, and snippets.

@robi09
Created March 9, 2016 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save robi09/d06137b7de21226a3e76 to your computer and use it in GitHub Desktop.
Save robi09/d06137b7de21226a3e76 to your computer and use it in GitHub Desktop.
WordPress new logo theme support function
/**
* Display the logo in your theme using the following functions: the_site_logo() and get_the_site_logo()
* Check if logo exists using the following function: has_custom_logo()
* The the_site_logo() function output is <a href="%1$s" class="site-logo-link"><img class="site-logo" data-size="%2$s" /></a>. Make sure you use the appropriate CSS classes in your theme Front End.
* The function has this filter apply_filters( 'get_the_site_logo', $html, $size );
* Use "site_logo" id in JS to create Customizer Transport
*/
/**
* Check WordPress version
*
* @param string $tocheck - WP version you want to check against the current version
* @return boolean
*/
if(!function_exists('blesk_check_wp_version')) {
function blesk_check_wp_version($tocheck) {
//Get current value
global $wp_version;
//Check if $tocheck exists, if not the function will return always false
if(!$tocheck) {
$tocheck = $wp_version;
}
return ($wp_version > $tocheck ? true : false);
}
}
//This functioon goes in your theme setup function
if(blesk_check_wp_version('4.5')) {
add_image_size( 'blesk-logo', 276, 83 );
add_theme_support( 'custom-logo', array( 'size' => 'blesk-logo' ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment