Tagged: _blank, load more button, masonry, target
Hi
I’m using masonry gallery within a color-section for opening url’s with target _blank. Found that solution in this forum:
function add_custom_target(){
?>
<script>
jQuery(window).load(function(){
jQuery(‘#av-masonry-1 a’).attr(‘target’,’_blank’);
});
</script>
<?php
}
add_action(‘wp_footer’, ‘add_custom_target’);
https://kriesi.at/support/topic/portfolio-grid-links-not-opening-in-new-window/#post-346592
This works fine, until I’m using the “Load More” Button. The links of the new loaded images are not longer _blank. How could I resolve this problem? Thanks for your help.
I hope, in the future, there will be the possibility to chose the target within masonry.
Hi baiker!
Thank you for using Enfold.
Please replace the code with this:
function add_custom_script(){
?>
<script>
(function($){
$('.av-masonry a:not(".av-masonry-pagination")').attr('target','_blank');
$('.av-masonry-pagination').click(function() {
setTimeout(function() { $('.av-masonry a:not(".av-masonry-pagination")').attr('target','_blank'); }, 3000);
});
})(jQuery);
</script>
<?php
}
add_action('wp_footer', 'add_custom_script');
Remove browser cache then reload the page.
Best regards,
Ismael
Hi Ismael
You’re the hero!! Thanks, works perfect.
Best regards,
René