Changing the URL the header logo points to
-
Basel is deployed on a site inside my subdomain-based multisite WP. I want the header logo to link to the parent domain rather than the subdomain it is deployed on, e.g. I want it to link to mydomain.com rather than shop.mydomain.com.
How can I achieve this? I don’t want to override core PHP files in my child theme, which are bound to change between releases.
Nor do I want a JS solution, as it won’t play well with the link analysis done by Google and crawlers.
Thanks.
Hello,
The only one way is to do this is to override logo function in the child theme functions.php file. You can’t do this in any other way. You can put this code to your child theme
function basel_header_block_logo() {
$header_color_scheme = basel_get_opt( 'header_color_scheme' );
// Get the logo
$logo = BASEL_IMAGES . '/logo.png';
$logo_white = BASEL_IMAGES . '/logo-white.png';
$logo_uploaded = basel_get_opt('logo');
$logo_white_uploaded = basel_get_opt('logo-white');
if(isset($logo_white_uploaded['url']) && $logo_white_uploaded['url'] != '') {
$logo_white = $logo_white_uploaded['url'];
}
if(isset($logo_uploaded['url']) && $logo_uploaded['url'] != '') {
$logo = $logo_uploaded['url'];
}
if( $header_color_scheme == 'light' ) {
$logo = $logo_white;
}
$protocol = basel_http() . "://";
$logo = $protocol. str_replace(array('http://', 'https://'), '', $logo);
$logo_img = '<img src="' . $logo . '" alt="' . get_bloginfo( 'name' ) . '" />'
?>
<div class="site-logo">
<a href="HTTP://YOUR_URL.COM" rel="home">
<?php echo ( $logo_img ); ?>
</a>
</div>
<?php
}
Regards
Thanks. You have built a quality theme, clearly with extensibility in mind!
The function_exists check in the parent theme is what made overriding the function possible in the child theme.
I come from using Jupiter, and oh man. Doing anything with that theme is a major pain in the *ss.
Cheers!
We are glad that our customizability features are good for you. Hope you will build an awesome website with Basel. Anyway, we would be glad to hear any additional advice or feature requests from you to make it even better.
Thank you in advance!