The new Site Logo module in the popular Jetpack plugin allows you to insert a logo on your WordPress site using the theme configurator. The selected logo will continue to be displayed even when changing the theme if the selected new theme supports this module.
The Site Logo module appeared in the popular Jetpack plugin version 4.6, and support for this module has already been included in more than five themes from Automattic: Edin, Goran, Sidekick, Sketch, Superhero. Many other WordPress theme developers will surely follow suit.
The interface for managing the logo looks like this (in the Appearance → Customize menu):
Here in the Logo section, you can upload a new image or select a previously uploaded file from the WordPress media library.
Please note that each theme may declare its own logo size and cropping options, so if you are using a new theme you may need to re-upload your logo.
You can also use the Regenerate Thumbnails plugin to update the dimensions for your entire media library, or the Photon module in the Jetpack plugin for dynamic sizes using WordPress.com.
How to Add Site Logo Support to an Existing Theme
If you are using an existing WordPress theme that does not support Jetpack’s Site Logo module, then you can declare support using a child theme in the functions.php file during the event after_setup_theme:
function my_after_setup_theme() { add_theme_support( 'site-logo' ); } add_action( 'after_setup_theme', 'my_after_setup_theme' );
Then, in the place where you want to display the selected logo (for example, the header.php file), use the function jetpack_the_site_logo():
if ( function_exists( 'jetpack_the_site_logo' ) ) jetpack_the_site_logo();
Checking the function with function_exists()is required, otherwise, your theme will throw a PHP error if the Site Logo module of the Jetpack plugin is not active.
Also See: WordPress SMTP Configuration
By default, the Site Logo module will use a medium size for the selected logo, but theme developers can set their own size using the built-in kernel function add_image_size()and argument size when declaring Site Logo support:
function my_after_setup_theme() { add_image_size( 'my-theme-logo-size', 200, 200, true ); add_theme_support( 'site-logo', array( 'size' => 'my-theme-logo-size' ) ); } add_action( 'after_setup_theme', 'my_after_setup_theme' );
Thus, the uploaded logo will be reduced to 200 by 200 pixels with forced cropping.
The implementation of the Site Logo functionality can be found in the source code of the Jetpack plugin in the modules/theme-tools/site-logo.php directory. By the way, this file (and the site-logo directory) can be used as a separate plugin if you don’t want to force users of your theme to install and include the Jetpack plugin.
It is also possible that such functionality may appear in the core of WordPress in the future.