Changing the site logo through WordPress customization

I have designed a WordPress theme for my site.

I have added WordPress codes to control some parts of my theme to make the changes I want through skin customization.

For example, to change the title of the site through Customize >> Site Identity, I have added the following code to my template:

 <?php bloginfo('name'); ?>

Also, for the short introduction of my site, I have entered the following code so that I can easily control the short description of my site at any time:

<?php bloginfo('description'); ?>

But I couldn’t find a code to change the logo of my site, and to change the logo of the site, I have to change the image I made for this purpose from within my template files, which is very difficult and unprofessional.

I’m only looking for a piece of code so that I can control the site logo from within the skin customization like the site title and short introduction.

>Solution :

The custom-logo theme support may be what you are looking for.

Using a custom logo allows site owners to upload an image for their website, which can be placed at the top of their website. It can be uploaded from Appearance > Header, in your admin panel. The custom logo support should be added first to your theme using add_theme_support(), and then be called in your theme using the_custom_logo(). A custom logo is optional, but theme authors should use this function if they include a logo to their theme.


Leave a Reply