Tagged: masonry
I submitted this question twice – sorry. I don’t know how to delete one!
I have added the code in the child functions.php file (as suggested here: https://kriesi.at/support/topic/how-to-masonry-items-open-in-a-new-window/?login_error) but portfolio items won’t open in a new window from the Masonry Grid. Do I need to do anything else?
Code: function masonry_links () {
?>
<script>
window.addEventListener(‘DOMContentLoaded’, function() {
(function ($) {
$(document).ready (function () {
var url = new RegExp(location.host);
$(‘.av-masonry-entry’).each(function () {
if( ! url.test($(this).attr(‘href’)) ) {
$(this).attr(‘target’, ‘_blank’);
}
});
});
}) (jQuery);
});
</script>
<?php
}
add_action (‘wp_footer’, ‘masonry_links’);
Hi ElizabethEnglish,
No worries, we will just close this thread and proceed with the discussion on your other thread. :)
Best regards,
Nikko