1. You have to enable custom logo feature in theme by using below code in functions.php file
function theme_name_features() { /** * Add support for core custom logo. */ $logodefault = array( 'height' => 75, 'width' => 115, 'flex-height' => true, 'flex-width' => true, 'unlink-homepage-logo' => true, ); add_theme_support('custom-logo', $logodefault); } add_action('after_setup_theme', 'theme_name_features');
2. Update Your Logo from the admin panel.
3. Call the updated logo in the header.php using the below code.
<div class="logo"> <a href="<?php echo site_url() ?>"> <?php $custom_logo_id = get_theme_mod( 'custom_logo' ); $logo = wp_get_attachment_image_src( $custom_logo_id , 'full' ); if(has_custom_logo()) { echo '<img src="' . esc_url( $logo[0]) . '" alt="' . get_bloginfo( 'name' ) . '">'; } else { echo '<strong>'. get_bloginfo( 'name' ) .'</strong>'; } ?> </a> </div>
1 Comment
Kenneth Blomker · April 22, 2022 at 11:10 pm
Great web site you have here.. It’s difficult to find quality writing like yours nowadays. I truly appreciate people like you! Take care!!