-
AuthorPosts
-
March 1, 2018 at 7:45 pm #919835
Hi,
I’d like all masonry gallery links open in new tab with the attribute “nofollow”. How can I do it?- This topic was modified 6 years, 8 months ago by Monica.
March 2, 2018 at 11:45 am #920244Hey mstasik,
Thank you for using Enfold.
The gallery items will open a lightbox unless a “Custom Link” is specified. Do you want to disable the lightbox feature?
Best regards,
IsmaelMarch 5, 2018 at 5:12 pm #921599Most of my masonry galleries will not have links and will need to keep lightbox enabled. Just in selected masonry galleries I’d like to add links to external websites (see the second gallery on my website where I present computers and logotypes of my clients). When I add “Custom Link” the lightbox is disabled (this is OK, works fine, this does not need to be changed) and the links work fine and open the relevant websites. But I’d like the masonry gallery with links to open the links in NEW TABS and have attribute NOFOLLOW. Now the links from masonry gallery are opened in the same tab, so users are leaving my website which I do not want.
March 6, 2018 at 12:44 pm #922207Hi,
Thank you for the info.
This script will apply the target and rel attributes to the masonry items with custom links. Just add the code inside the functions.php file.
add_action('wp_footer', 'ava_custom_script'); function ava_custom_script(){ ?> <script type="text/javascript"> (function($) { function a() { $('.av-masonry-entry:not(".lightbox-added")').each( function() { $(this).attr('target', '_blank'); $(this).attr('rel', 'nofollow'); }); } a(); })(jQuery); </script> <?php }
Best regards,
IsmaelMarch 6, 2018 at 2:28 pm #922305This reply has been marked as private.March 6, 2018 at 2:52 pm #922320Hi mstasik,
Yes, please remove the last closing php descriptor. You will have to do it via FTP.
Best regards,
VictoriaMarch 6, 2018 at 3:17 pm #922345Hi Victoria,
website displays content again, but the added script regarding links in masonry gallery with “custom links” ( I wanted the “custom links” _blank & nofollow) does not work.March 8, 2018 at 8:23 pm #924033Hi,
Can you please use the code as following
https://pastebin.com/nwejyRChseems that the ‘ was not properly and it was replaced because of forums.
Thank you
Best regards,
BasilisMarch 9, 2018 at 9:01 am #924345Hi, I’ve used your code, but still the links from masonry gallery are opened in the same tab. Is there anything we could do about it?
March 9, 2018 at 3:02 pm #924523Hi mstasik,
Can you please enable Appearance > Editor for now?
Here is how to do itBest regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.