Tagged: image, open in new tab, social media
Hi guys,
I have two images of companies in the footer which are in a widget and they have to be linked to their respective websites. I put the following code in the widget since there isn’t a way to place an image in the footer automatically (at least to my knowledge).
<a href="http://www.maltacvs.org/" target= "_blank"><img src="http://newsite.specialolympicsmalta.org/wp-content/uploads/2016/04/MVC-for-Web-01.png" width="500" height ="200" /img></a>
As you can see, in theory, the image should open in a new tab but it doesn’t.
I also have this issue with the social media buttons, which are located in the header, and I require them to open up in a new tab once clicked on.
http://newsite.specialolympicsmalta.org/
Any help appreciated.
Hi Matthew!
Please add following code to functions.php file in Appearance > Editor
function custom_link_target(){
?>
<script>
jQuery(window).load(function(){
jQuery('#top .social_bookmarks li a,#footer #text-3 a, #footer #text-4 a').attr('target','_blank');
});
</script>
<?php
}
add_action('wp_footer', 'custom_link_target');
Regards,
Yigit
Ah Yigit,
Always to the rescue. Why there isn’t the title of ‘Savour of all low and hold of Enfold’ is beyond me :D
The code worked and everything is perfect. Just one thing that I would like to arrange is that when you hover over the images of the footer they get a hover effect. Can you please pass the code to remove this please?
Thanks again!
Matt
Hey!
Please add following code to Quick CSS as well
#footer .image-overlay { display: none !important; }
Regards,
Yigit
Thanks a million Yigit! Spot on! :)