• Resolved mbsharp

    (@mbsharp)


    In the Description field for a gallery image, it is possible to put html code. For example I like to link an image to an external website using such as this:
    <a href=”theirsite.com”>Website</a>

    However, I would really like to open that website in a new window such as this:
    <a href=”theirsite.com” target=”_blank”>Website</a>
    but when I do that and then save changes, the target attribute is deleted.

    Is there a reason for that or can it be changed?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Jaime Segura

    (@jaimeimagely)

    Hi,

    Only basic html can be used, most tags will be stripped. There is no option to change this at the moment.

    Could you please elaborate a bit? There might be a script that adds the “target blank” to links inside certain elements, we would need to know what display type you are using (you can share the shortcode) and also what lightbox.

    Let me know at your earliest convenience.

    Thread Starter mbsharp

    (@mbsharp)

    Thanks for reply.

    Using Basic Thumbnail display. Gallery options settings include default-view.php. Examining the assembled page html suggests class fancybox.

    At the moment, ‘target=”_blank” is stripped when editing the gallery data itself, but I appreciate there may be a way of adding it back during display via a CSS injection.

    Plugin Support Jaime Segura

    (@jaimeimagely)

    Try adding this script to your site

    <script >window.onload = function(){
     var anchors = document.getElementById('fancybox-title-inside').getElementsByTagName('a');
     for (var i=0; i<anchors.length; i++){
      anchors[i].setAttribute('target', '_blank');
     }
                      
      }</script>

    See if that works and let me know

    Thread Starter mbsharp

    (@mbsharp)

    Thanks for the suggestion.
    I used WPCode plugin to insert the script. I tried both in footer and in body.
    Unfortunately, no go. Examining the page content, there is no element with ID ‘fancybox-title-inside’. Even if there was it would only select the first item on the page and not all images in the gallery.
    There are classes ngg-gallery-thumbnail and ngg-fancybox but if they are selected, then there are several <a> tags including the gallery image itself.

    Thread Starter mbsharp

    (@mbsharp)

    It is easiest to add a user instruction on the page to hold Shift before clicking on the link. This opens the link in a new window.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘html in Description’ is closed to new replies.