Notice the social sharing links in the header are not opening in a new tab, as should be standard. How can I make the site do this?
But also, the same thing is happening to social icons I have hard coded into the footer widget. They are set to “target=_blank” and they are still opening in the same browser tab.
Is this a bug in enfold? Or am I missing a setting in the theme somewhere?
Thanks,
Rob
Hey robphat,
For the social bookmarks in your header add this to the bottom of your functions.php file.
//add_filter('wp_footer', 'avf_social_attr', 10);
function avf_social_attr() { ?>
<script>
(function($){
$(window).load(function(){
$(".social_bookmarks a").attr("target", "_blank");
});
})(jQuery);
</script>
<?php
}
Your target=”_blank” in the footer didn’t work, but you could try this plugin: https://wordpress.org/plugins/open-external-links-in-a-new-window/
Best regards,
Mike
The first code to open social links in new tab didn’t work, but the plugin https://wordpress.org/plugins/open-external-links-in-a-new-window/ did work. It took care of both.
But out of curiosity, whey doesn’t target=_blank work on enfold?
Hi,
Glad you found a solution and thanks for sharing, target blank work but there might have been a mistake in the code.
Best regards,
Rikard
Ok thanks. I saw some other Posts online where some WordPress themes target=_ blank was not working properly either. And they suggested the plug-in you suggested. So I guess there is something in the theme that prevents yarget=_blank from working. In either case the plugin helped. Thanks