1. PROMO Upgrade to Pro Membership @ $99 / Lifetime & access all our 16+ premium Divi extensions: Divi Block, Carousel Toolkit, etc.LEARN MORE
Dismiss Notice
NEW Divi.Help Pro Carousel AI Toolkit - Magically turn your Divi design into carousel, simply by using our online toolkit. No plugins needed. Now it works with Divi 5 as well!Try our carousel AI toolkit
BEST Divi Block - A revolutionary drag & drop tool to easily mix & match 960+ premade blocks (Light & Dark) to kick start your Divi site design. Special module designs are included as well. Also newly added AI generator & color. Now it works with Divi 5 as well!
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

Solved How do I add a custom link to an icon in a DIVI blurb?

Discussion in 'Free Divi Community Forum' started by Nickk, Jun 5, 2020.

  1. Nickk

    Nickk New Member

    I have a DIVI blurb with icon. In the blurb I have a link as text:

    `<p><a href="url" onclick="window.open(this.href,'targetWindow','toolbar=no,scrollbars=no,resizable=yes,fullscreen=yes'); return false;" rel="noopener noreferrer">Goooo</a></p>`

    I would also like this link to apply when a user clicks on the blurb's icon. How can I achieve this?
     
    1. PRO MEMBER PERKS Divi Block Pro - Premade mega menu design for your Divi site without using any plugins:View Demo
  2. Divi.Help

    Divi.Help Administrator
    Staff Member

    If you set the Title Link URL (see screenshot below), then it will add the link to your blurb icon & title.

    upload_2020-6-6_14-20-47.png
     
  3. Nickk

    Nickk New Member

    Thanks. The problem I'm having is what to enter there as the link in such a way that it actually processes the parameters. I've tried the syntax below but that didn't work.

    google.com onclick="window.open(this.href,'targetWindow','toolbar=no,scrollbars=no,resizable=yes,fullscreen=yes'); return false;" rel="noopener noreferrer"
     
    1. PRO MEMBER PERKS Custom Color Scheme + Premade Layouts - A perfect combination to boost productivity:Try Now
  4. Divi.Help

    Divi.Help Administrator
    Staff Member

    For that case, you will need to use custom jQuery code to wrap the link.

    First, go to the Blurb module settings > Advanced > CSS Class & add dh-custom-link

    And lastly, add the below code in WP Admin > Divi > Theme Options > Integration > Body Code:
    Code:
    Log In or Sign Up to view this code.
    Adjust the URL to fit your need.
     
  5. Nickk

    Nickk New Member

    Thank you for having another look.
    To simplify the code a bit. When I use:

    <script>jQuery(function($){$(".custom-link .et_pb_image_wrap").wrap('<a href="google.com" onclick="window.open(this.href,'targetWindow')"></a>');});</script>

    in the console I have the error: "Uncaught SyntaxError: missing ) after argument list"

    When I remove the targetWindow, the error is gone (but then the link doesn't work the way I want it to:

    <script>jQuery(function($){$(".custom-link .et_pb_image_wrap").wrap('<a href="google.com" onclick="window.open(this.href)"></a>');});</script>
     
    1. PRO MEMBER PERKS Beautifully crafted custom colored 'Industrial' Divi layout for all Pro members:View Demo
  6. Divi.Help

    Divi.Help Administrator
    Staff Member

    Try to add \ before the quote symbol:

    \'targetWindow\'
     
  7. Nickk

    Nickk New Member

    Awesome, now it works!
     
    1. PRO MEMBER PERKS Divi Ultimate Archive Plugin - Tons of elegant premade sidebar styles to choose from for your Divi site:Learn More