Tagged: masonry grid
-
AuthorPosts
-
October 2, 2016 at 11:53 pm #694371
Hello, I have been searching threads on this topic but can’t find a solution that seems to work for me. The threads seem to be older. I would like the image links in the masonry portfolio to open to a new tab. Is there some code I could work with to make this happen? I am using version 3.8
- This topic was modified 8 years, 2 months ago by Tate.
October 4, 2016 at 2:38 pm #695059Hey Karen,
Please edit your masonry element and give it a unique ID and then add following code to Functions.php file in Appearance > Editor
function avia_masonry_target(){ ?> <script> jQuery(window).load(function(){ jQuery('#your-custom-id a').attr('target','_blank'); }); </script> <?php } add_action('wp_footer', 'avia_masonry_target');
If you need further assistance, please create a temporary admin login and post it here privately when you launch your website.
Best regards,
YigitOctober 4, 2016 at 7:29 pm #695195Thanks Yigit,
So just to clarify: if I use the word gallery for my id in the masonry element, then in functions.php would look like this: (‘#gallery a’) .
I am also using a child theme so would this be put in a functions.php file in the child theme?Kind Regards,
KarenOctober 4, 2016 at 7:49 pm #695205October 5, 2016 at 10:21 pm #695789Hi Yigit,
So I have added the suggested code into the functions.php file in the child theme. Unfortunately it is still not working.
I have launched a demo site so you can have a look.
login details below.Kind Regards
Karen
October 5, 2016 at 10:27 pm #695794Hi,
ID is not being applied. I changed the code to following to target color section element your links are in
function avia_masonry_target(){ ?> <script> jQuery(window).load(function(){ jQuery('#projects a').attr('target','_blank'); }); </script> <?php } add_action('wp_footer', 'avia_masonry_target');
Please review your website now
Best regards,
YigitOctober 5, 2016 at 11:14 pm #695803Hi Yigit,
Thank you! I thought I was to add the ID to the masonry element so I must have misunderstood.I did have an ID in the color section for the main menu anchor (projects). That is also not working. I was going to open a new thread but if you are able to help me with that as well that would be great. When I click on the main menu items they are not scrolling to the identified section. I have used the one page website on other sites before and have had no trouble with the anchors. If you would like me to open a new thread I can do that too.
K.
October 8, 2016 at 9:48 am #696871 -
AuthorPosts
- The topic ‘Need portfolio masonry grid link to open in new tab’ is closed to new replies.