Tagged: Masonry Gallery
Hi!
I was looking for a code to make the links in the masonry gallery open in a new window. I found three different codes, one from Josue (topic 280969), another one from Dude (topic 233031), and one from Ismael (topic 184988), but neither of them seems to work, and because the persons that started the topic didn’t respond if the code worked or not, I’m just trying to figure out if something is missing.
Thanks for your help!
Hi C-LabMX,
I’ve tried using Josue’s method and it works!
Find the functions.php file at this location: /themes/enfold/
Just go to line 465, after
avia_register_avia_widgets(); //call the function immediatly to activate
}
and before
/*
* add post format options
*/
add_theme_support( 'post-formats', array('link', 'quote', 'gallery','video','image','audio' ) );
and paste this code:
function add_custom_script(){
?>
<script>
jQuery(window).load(function(){
jQuery('.av-masonry a').each(function(){
jQuery(this).attr('target', '_blank');
});
});
</script>
<?php
}
add_action('wp_footer', 'add_custom_script');
Save and ftp back to the directory.
Hope this helps.
Cheers :)
Hey!
@odmv91 Josue’s method is the easiest to apply and you can check right away.
@mhafeezmm Thanks :)
Cheers!
Yigit
Hi!
Thanks for your help mhafeezmm and your response Yigit!
It seems that the fault was by one plugin that wasn’t loading correctly the function, so now it works great!