I found the following code and it does the job
function add_custom_target(){
?>
<script>
jQuery(window).load(function(){
jQuery('.av-masonry-container a ').attr('target','_blank');
});
</script>
<?php
}
add_action('wp_footer', 'add_custom_target');
It does it a little to well though. That causes all masonry elements site wide to open in new window.
Would it be possible to target a certain page rather than site wide? Maybe through page-id?
Many Thanks
Tim
Hey tjswarbs78,
Yes it is possible to target certain pages
Edit the below line and add the page id before .av-masonry-container
jQuery('.av-masonry-container a ').attr('target','_blank');
It should look like
jQuery('.page-id-xx .av-masonry-container a ').attr('target','_blank');
Best regards,
Vinay
OMG i can’t believe i didn’t think of that!
Thanks
TJ