WP: Add Support for Custom Logo in Theme
Add support for custom logo image upload in Wordpress website using Wordpress built-in function.
In adherence to our rigorous editorial policy, this article's content has undergone careful testing for accuracy and trustworthiness and hence, this content is marked source of information. View editorial history of this content.
Custom logo can be used in dynamic top navigation bars or other places within theme. Add a support for setting custom logo using WordPress built-in function from the backend.
Step 1: Add custom logo support using add_theme_support
function in functions.php of child theme or parent or where needed.
add_theme_support( 'custom-logo');
Step 2: Set the logo in the backend or let the user set it.
- Go to the Admin Dashboard > Appearance > Customizer > Site Identity
- Set the logo image
Step 3: Print the logo on frontend
There are two ways to print custom logo on frontend of website.
Method 1: With markup
Just use the_custom_logo()
function to print logo image with img
markup. No need of echo
since it already echos the markup directly.
<?php the_custom_logo(); ?>
Method 2: Without markup, just get the source
If you have defined your custom logo image markup already, read ‘WP get custom logo image URL‘ guide. It’ll also help you to get the custom logo URL or source in different custom image sizes.
Digital Setups has enforced a strict sourcing policy. Every content piece published on our website is passed through strict editorial review for contextual correctness, communication ethics, and programmatic tests wherever required. Our team research solutions from only credible, authentic, and trustworthy sources. Learn more about our editorial process.
Based on our editorial policy, we update our content time to time to ensure its usefulness, reliability, and validity.
Our standardized editorial process ensures right, timely, and usefulness updates to our content. Your honest opinion drives significant improvement to our content. We appreciate you are taking time to share that.
Readers who read this also found these helpful:
- Authorship in SEO (2022)
- Using ‘Advertisement’ or Similar Term above AdSense Ads
- Facebook Meta for Business Suite Hacked. Can you take it back?
- Woo Express – How it works, Features, & Pricing
- wp_list_users_args Hook – Explanation & Usage Example
- Search Console: Fix “Alternate page with proper canonical tag” Error in Page Indexing
- Woo Express vs. Pressable WooCommerce Hosting
- Search Console: Fix “LCP issue: longer than 2.5s (mobile)” Issue
- IPO Trademark Search in Pakistan
- Block Editor: theme.json – Color Palette