So you added all your social media accounts to the Divi Options General tab but then you discover that when a visitor clicks on a link it takes them away from your site to the social media site and you don’t see them again for ages… well in this tutorial I’m going to show how easy it is to have those links open in a new tab.

The Code

All the hard work is done by the small piece of JavaScript below. It basically injects a little bit of HTML into these links which makes them open in a new browser tab (what would we do without tabs).

To make the magic happen, you need to add this bit of code to the field labelled “Add code to the < body > (good for tracking codes such as google analytics)” which you’ll find under the Integration tab of the Divi Theme Options screen.

If you already have other JavaScript there, you can simply add it to the bottom of this field.

Wrapping It Up

So that folks is really how easy it is to have Divi’s built-in social media icons open in a new tab. This will also work with social media icon’s you’ve added manually if you’ve followed the How to Add More Social Media Icons to Divi tutorial on elegantthemes.com.

Support Divi Notes

Divi Notes started as a way to document my own WordPress and Divi web design/development journey and, to my delight, has grown to become a helpful resource to many other Divi users out there. If you’ve found Divi Notes to be useful in your journey, I’d appreciate it if you would consider supporting me using the form below.

$
Personal Info

Donation Total: $4.99