How to conditionally remove site branding from Kadence

Disclosure: This post may contain affiliate links – meaning I get a commission if you decide to make a purchase through my links, at no cost to you.

Here’s a code snippet to remove the site branding just from the homepage of a site that uses Kadence:

add_action( 'kadence_main_header', 'wn_remove_site_branding' );
function wn_remove_site_branding() {
	// if this is not the homepage, abort.
	if ( ! is_front_page() ) {
		return;
	}

	remove_action( 'kadence_site_branding', 'Kadence\site_branding' );	
}

The above prevents the following (for example) from being output:

<div class="site-branding branding-layout-standard site-brand-logo-only"><a class="brand" href="https://kadence-blank.local/" rel="home" aria-label="Kadence Blank"><img width="800" height="320" src="https://kadence-blank.local/wp-content/uploads/2020/09/cropped-pennant-1.jpg" class="custom-logo" alt="Kadence Blank" srcset="https://kadence-blank.local/wp-content/uploads/2020/09/cropped-pennant-1.jpg 800w, https://kadence-blank.local/wp-content/uploads/2020/09/cropped-pennant-1-300x120.jpg 300w, https://kadence-blank.local/wp-content/uploads/2020/09/cropped-pennant-1-768x307.jpg 768w, https://kadence-blank.local/wp-content/uploads/2020/09/cropped-pennant-1-600x240.jpg 600w" sizes="(max-width: 800px) 100vw, 800px"></a></div>

inside

<div class="site-header-item site-header-focus-item" data-section="title_tagline">
	</div>

Reference

/wp-content/themes/kadence/inc/template-hooks.php

Similar Posts

2 Comments

  1. Tried using the snippet and got:

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘wn_remove_site_branding’ not found or invalid function name in /home/redwinho/public_html/XXX.com/wp-includes/class-wp-hook.php on line 287

Leave a Reply

Your email address will not be published. Required fields are marked *