The Extra Theme allows you to add social media icons / links in the header and footer. If you’d like those links to open in a new tab, you can do so with the following jQuery code:
<script>
jQuery(function($){
$('.et-extra-social-icon a').attr('target','_blank');
});
</script>
You can add this to the theme by pasting it into "Extra > Theme Options > Integration > Add code to the head of your blog", after anything else that is in there.
If you’re not comfortable adding jQuery code to your site, you can use my Divi Booster plugin to configure the social icons to open in a new tab. The setting you need is located at “Extra > Divi Booster > Site-wide Settings > Icons > Open social media icon links in a new tab”. Divi Booster also allows to add over 160 new social icons to the top header and footer.
Hi, there’s no code in this article, please can you update it?
Hi Lizzie, I’m not sure what happened. I’ve restored it, so you should hopefully be able to see it now. Thanks!
Whenever I paste the code in ‘Add code to the of your blog’ it shows ‘please use tab for indentation’ in the second line. Then I’ve deleted the spaces before the second line and put ‘TAB’ instead. But still, the code doesn’t work for me. Please help me out. Thanks.
Hi Saddam, I’ve updated the code above to fix this. I don’t think the issue actually has anything to do with indentation. Rather, the code needs to be surrounded by “script” tags which I had forgotten to include. I hope it helps, but let me know if not. Thanks!
it says ‘unexpected token’ can you please fix the code:((
Hey dap, there doesn’t seem to be an issue with the code itself – it’s working for me when I use it in the “Extra > Theme Options > Integration > Add code to the head of your blog” box. Can you double check that the code has been copied correctly (including the script tags) into that box? If you’re still having problems, perhaps you can send me a screenshot of the code / error? I’ll send you an email now that you can attach the image to. Thanks!