Note that there are some explanatory texts on larger screens.

plurals
  1. POopen external links in new tab, embeded in fancybox popup
    text
    copied!<p>I am trying to manipulate the following code to open a link in a new tab. Which is embeded in fancybox 1.3.4 popup. The issue is adding target="_blank" and onclick function gets ignored and causes the link to open in the parent page. I have also tried using javascript void (0) target"_blank" and have managed to leave the page in a new tab however the new page is blank when it appears. </p> <p>this is the line of the code I am trying to manipulate to leave fancybox and open in a new tab:</p> <pre><code>$link = ($attachment_meta)? "&lt;a href='$attachment_meta'&gt;$image&lt;/a&gt;" : $image; ex: $link = ($attachment_meta)? "&lt;a href='$attachment_meta' target'_blank'&gt;$image&lt;/a&gt;" : $image; &lt;-- adding target_blank in code does not work!-- </code></pre> <p>This is a snippet of the code:</p> <pre><code>if( 'custom' == $attr['link']){ $image = wp_get_attachment_image($id, $size, false); $attachment_meta = get_post_meta($id, '_rt-image-link', true); $link = ($attachment_meta)? "&lt;a href='$attachment_meta'&gt;$image&lt;/a&gt;" : $image; } else { $link = isset($attr['link']) &amp;&amp; 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false); } $output .= "&lt;{$itemtag} class='gallery-item'&gt;"; $output .= " &lt;{$icontag} class='gallery-icon'&gt; $link &lt;/{$icontag}&gt;"; if ( $captiontag &amp;&amp; trim($attachment-&gt;post_excerpt) ) { $output .= " &lt;{$captiontag} class='wp-caption-text gallery-caption'&gt; " . wptexturize($attachment-&gt;post_excerpt) . " &lt;/{$captiontag}&gt;"; } $output .= "&lt;/{$itemtag}&gt;"; if ( $columns &gt; 0 &amp;&amp; ++$i % $columns == 0 ) $output .= '&lt;br style="clear: both" /&gt;'; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload