I'm trying to use my custom logo, uploaded from Appearance > Header. But none of the parameters I have set in my_custom_logo_setup are working.
In functions.php
//Add custom logo function my_custom_logo_setup() { $defaults = array( 'height' => 100, //not working! 'width' => 100, //not working! 'flex-height' => true, //not working! 'flex-width' => true, //not working! 'header-text' => array( 'site-title', 'site-description' ), //not working! 'unlink-homepage-logo' => true, //not working! ); add_theme_support( 'custom-logo', $defaults ); } add_action( 'after_setup_theme', 'my_custom_logo_setup' );
In header.php:
<header id="masthead" class="site-header site-title site-description"> <div class="site-branding"> <?php if ( function_exists( 'my_custom_logo_setup' ) ) { the_custom_logo(); } ?> <h1 class="site-title">Titulo</a></h1> <p class="site-description">Description</a></p> </div> <!-- .site-branding --> <!-- <nav id="site-navigation" class="main-navigation"> </nav> --> <!-- #site-navigation --> </header><!-- #masthead -->
my_custom_logo_setup
rather thanthe_custom_logo
as is usual. Why?after_setup_theme
?add_action( 'after_setup_theme', 'my_custom_logo_setup', 999 );
The last number is the priority. This means this action will be added after other actions. So if there is a plugin that also ads a custom logo, it will be overwritten by your code. But there could also be filters that override the logo.