Hi,
I’ve recently designed a site for a client as a sub site, when clicking the logo it takes the viewer to the parent company site.
They have requested that this link should open in a new tab.
I’m running a child theme and used the following code in the functions.php
add_filter('avf_logo_link','av_change_logo_link');
function av_change_logo_link($link)
{
$link = "https://www.ABCXYZ.co.uk";
return $link;
Is there a way you can help me to do it please?
I think I found something that sort of does what I need here: https://kriesi.at/support/topic/changing-the-header-logo-link/
function av_logo_link_target(){
?>
<script>
jQuery(window).load(function(){
jQuery('.logo a').attr('target','_blank')
});
</script>
<?php
}
add_action('wp_footer', 'av_logo_link_target');
Thanks @yigit
The problem is that it doesn’t work on the homepage, but it does everywhere else. Can you help with the final step?
I’m feeling very smug, because I don’t know php, but this works
function av_alternate_logo_active(){
?>
<script>
jQuery(window).load(function(){
jQuery('.logo a').attr('target','_blank')
});
</script>
<?php
}
add_action('wp_footer', 'av_alternate_logo_active');