Created
October 23, 2017 06:56
-
-
Save sarathlal-old/154374fcd9a5e95665c6961c901f5b4a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
First add below code in theme's functions.php file | |
//Add logo support | |
function theme_prefix_setup() { | |
add_theme_support( 'custom-logo', array( | |
'height' => 60, | |
'width' => 200, | |
'flex-width' => true, | |
) ); | |
} | |
add_action( 'after_setup_theme', 'theme_prefix_setup' ); | |
//filter site logo and wrapping anchotr tag | |
add_filter( 'get_custom_logo', 'change_logo_class' ); | |
function change_logo_class( $html ) { | |
//$html = str_replace( 'custom-logo', 'your-custom-class', $html ); | |
$html = str_replace( 'custom-logo-link', 'navbar-brand', $html ); | |
return $html; | |
} | |
Then use below code to get custom logo | |
<?php | |
if ( function_exists( 'the_custom_logo' ) ) { | |
the_custom_logo(); | |
} | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment