Open Divi Slider Button Link in New Tab

To make Divi Theme's slider button links open in a new tab, you can add the following into the footer.php file (of the theme itself, or a child theme):

<script>
jQuery(function($){
    $('.et_pb_more_button').attr('target', '_blank');
});
</script>

This is available as an option in Divi Booster. You can find the option on the Divi Booster settings page under "Modules > Slider > Open slider links in new tab".

This post may contain referral links which may earn a commission for this site

Divi Booster

Hundreds of new features for Divi
in one easy-to-use plugin

19 Comments

  1. I Love you Dan. Thank you. Worked a treat. For anyone who wants to open other buttons in a new window, simply replace the class. For the pricing table buttons it would be

    jQuery(function($){
    $('.et_pb_pricing_table_button').attr('target', '_blank');
    });

    Reply
    • Thanks, Steve! :)

      Reply
    • Thanks a lot. You save me a hell of a stress.

      Reply
  2. Hi Dan – do you know a way to open any links in a new window?

    Reply
  3. hi dan, i just purchased diviboost because of this config, but I cannot find it anywhere in diviboost. can you pls advise?
    thank you

    Reply
    • Hi Felix, thanks for purchasing the plugin. You'll find the option on the Divi Booster settings page under "Modules > Slider > Open slider links in new tab". Let me know if you still aren't able to spot it.

      Reply
  4. I know this was a while ago, but is there a way to limit just one slide out of many, to open the link in a new window/tab?

    Reply
    • Hi Mark, assuming you just have the one slider module on the page, you should be able to do it by adding a code module (anywhere) on the same page as the slider, then setting its content to:

      <script>jQuery(function($){$('.et_pb_slide_0 .et_pb_more_button').attr('target', '_blank');});>/script>
      

      The "et_pb_slide_0" refers to the first slide. Change to "et_pb_slide_1" for the second slide, "et_pb_slide_2" for the third slide, etc.

      Note that there code should all be placed on one line – no newlines.

      Reply
  5. Or if you only want it to happen on 1 page only just add a full width section add a code element and add the script above ;-)

    Reply
    • Ha! Yes, that's a great solution Tobias :)

      Reply
    • Used a full width section with code element and the code in your post, and it works like a charm! Many thanks!

      Reply
  6. Dan, is there a way to have the button link to an outside website instead of to another page within my current site?

    For example, I want the button to link to http://www.123.com, but when I enter that URL into the "Button URL" field, the button tries to redirect to http://www.MYDOMAIN.com/www.123.com

    Reply
    • Hi Marilee, make sure you enter the URL as "http://www.123.com" rather than "www.123.com". If you don't include the "http" part, it gets treated as a page on the current site.

      Reply
  7. I put the code in the of my site and it works fine. Is there any reason I should not do it this way?

    Reply
    • Hi Charlie, I think WordPress might have stripped part of your comment so I can't tell where you actually put it, but if it's working for you, then there shouldn't be any problem with where you put it.

      Reply
  8. Just did this and it worked like a charm!!! Thank you so much!!!

    Reply
  9. Will this open any of the promo buttons or call to action in a new window?

    Reply
    • Hi Tammy, it's just the slider buttons that it'll open in another window. I'll look into making the other buttons open in another window too.

      Reply

Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

Your email address will not be published. Required fields are marked *.