How to Make Divi Social Icons Open in a New Tab

by Last Updated: Sep 10, 2019Blog, Divi theme

Today I decided to write a little about an issue that I often see people asking questions in the Divi Facebook groups on which I’m active. The question is: “How to make the social icons open in a new window?” So here’s the solution:

 

Social Icons Open New Tab

 

There are more ways to do this. You could do that with a JavaScript code, but I prefer to use some custom HTML code for this. So just open the file social_icons.php that’s located in the Divi’s “includes” folder. Add the code target=”_blank” to the links that you want to open in a new window. Here’s an example of how the Twitter link will look like:

<a href=”<?php echo esc_url( et_get_option( ‘divi_twitter_url’, ‘#’ ) ); ?>” class=”icon” target=”_blank”>

However, do not save this file to its default location. Save it to your Divi child theme folder (if you don’t have a child theme yet, check this article) and don’t forget to keep the same directory path – so you’ll need to create the “includes” folder in your child theme’s main folder and then place the social_icons.php file into it.

Also make sure that the “” characters are copied correctly and are not “” or ¨¨. Sometimes you may need to enter them manually into the code snippet, because they may not be copied correctly.

That’s all from me for now. Hope I have helped some of you. :)

PS: You might also like to have a look at my other tutorial on how to add another social icon to Divi.

5 Free WordPress Plugins You Should Use

Banner Blue Biz Child Theme
Andrej
Author: Andrej

WordPress expert. Divi user since 2014. I blog about WordPress and Divi, my favorite WordPress theme. When I’m not working with WordPress or writing an article for this blog, I’m probably learning Italian. You can read more about me here.

Share This