• Resolved dsplwebsupport

    (@dsplwebsupport)


    We would like to have a pdf link open in a new tab/window, but it continues to open in the same window when we try to set the mla_target to blank within a shortcode.

    We’ve defined the shortcode item as:

    <td width="4%"class='gallery-icon'>
        <i class="fa fa-file-pdf-o" circle="no" size="14px" iconcolor="#0053a0" circlecolor="" circlebordercolor="" rotate="" spin="no" animation_type="0" animation_direction="down" animation_speed="0.1" animation_offset="" alignment="left" class="" id="download-icon"></i>
    </td>
    <td width="96%">
    <a href="[+file_url+]" mla_target="_blank">[+link+]</a>
    </td>

    We have also tried to pass the mla target blank through the shortcode call, but this has not worked either. All plugins are up to date, and we have WP 4.7.2 and Avada 5.0.6. An example page with PDFs can be found at https://www.deepsea.com/support/product-documentation/. Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for your question and for providing the details from your template; very helpful. It looks like you have defined a custom markup template and the above excerpt is from the “Item” section of the template; is that right?

    I believe the easiest solution for you would be to modify the link tag you already have in the template, e.g.:

    
    <td width="96%">
    <a href="[+file_url+]" target="_blank">[+link+]</a>
    </td>
    

    The mla_target parameter adds a target attribute to the links generated by the shortcode, but you are only using the URL portion of the link. The target="_blank" attribute is the actual HTML markup you need and in my testing it opened the document in a new browser tab.

    I hope the above suggestions work for you. I am marking this topic resolved but please update it if you have any problems or further questions regarding links and attributes in the [mla_gallery] output. Thanks for your interest in the plugin.

    Thread Starter dsplwebsupport

    (@dsplwebsupport)

    Thank you, David. Correct that we’re using the “item” section. Unfortunately removing the ‘mla_’ before target did not resolve the issue on our end. I copied the code you provided in our private site to test out the solution:

    <td width="96%">
    <a href="[+file_url+]" target="_blank">[+link+]</a>
    </td>

    After this didn’t work, I adjusted the code on another page that calls to pdf files at the end of the command from [ . . . mla_target="_blank"] to [. . .target="_blank"] and then tried removing the target code all together: none of these tweeks made a difference, and I’m truthfully not sure how they may relate/influence the shortcode itself.

    Much appriciated for your time.

    Plugin Author David Lingren

    (@dglingren)

    I went back to your site (https://www.deepsea.com/support/product-documentation/) and had a look at the HTML source. Here is one of the elements in your gallery:

    
    <td width="96%">
    <a href="https://www.deepsea.com/wp-content/uploads/HDMultiSeaCam_Specifications.pdf" target="_blank"><a class="fusion-no-lightbox" href="https://www.deepsea.com/wp-content/uploads/HDMultiSeaCam_Specifications.pdf" data-caption="" data-title="HDMultiSeaCam_Specifications" data-rel="iLightbox[postimages]">HDMultiSeaCam_Specifications</a>
    </td>
    

    You can see that the first tag contains the href and target="_blank" as specified in your template, but this is overridden by a second link tag around the title of the document. Try changing your template to something like:

    
    <td width="96%">
    <a href="[+file_url+]" target="_blank">[+title+]</a>
    </td>
    

    You can add in the other attributes like class="fusion-no-lightbox" and data-rel="iLightbox[postimages]" as you need to for your application.

    Thread Starter dsplwebsupport

    (@dsplwebsupport)

    Great. We’ve figured it out and are good to go. Thank you again, David! I’ll mark this as resolved.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Code to open internal links in new tab’ is closed to new replies.