-
AuthorPosts
-
February 17, 2014 at 12:06 am #224648
Hi,
I downloaded 2 plugins to add a link to an image in a gallery. Both times Enfold kept on showing the lightbox image. WP Gallery Custom Links and RPS Image Gallery where the plugins. Does anyone know if Enfold works with these plugins?
Regards,
David
February 17, 2014 at 9:37 am #224832Hey David!
Make sure that you use the latest version of Enfold 2.5.2 because otherwise you can’t add a link to your gallery images. Then install this plugin http://wordpress.org/plugins/wp-gallery-custom-links/ and insert this code:
add_filter('avf_avia_builder_gallery_image_link', 'avia_change_gallery_thumbnail_link', 10, 4); function avia_change_gallery_thumbnail_link($link, $attachment, $atts, $meta) { $custom_url = get_post_meta($attachment->ID, '_gallery_link_url', true); if(!empty($custom_url)) { $link[0] = $custom_url; $link['custom_link_class'] = 'aviaopeninbrowser'; } return $link; }
into your child theme functions.php file (at the very bottom).
Best regards,
PeterFebruary 17, 2014 at 10:08 am #224850Hi Peter,
I use the latest Enfold’s version. Your code creates an error when I copy paste it in functions.php:
Parse error: syntax error, unexpected T_FUNCTION in /home/wineengratisvakantie.nl/public_html/redline/wp-content/themes/enfold/functions.php on line 470
Regards,
David
February 18, 2014 at 4:08 am #225309February 18, 2014 at 10:32 am #225411This reply has been marked as private.February 18, 2014 at 10:32 am #225412It’s the functions.php file, not the functions-enfold.php file…
February 18, 2014 at 5:11 pm #225576Hey!
Did you install the plugin before adding the code?
http://wordpress.org/plugins/wp-gallery-custom-links/Regards,
JosueFebruary 18, 2014 at 8:20 pm #225706Yes, but I might have deactivated it because I downloaded another plugin for adding links to a gallery. Shall I remove the plugin, install it again and than add the code to functions.php?
Regards,
David
February 19, 2014 at 5:04 am #225935Hi!
You should use the WP Gallery Custom Links plugin. Add Dude’s code at the very bottom of functions.php. Make sure you have the latest version of Enfold.
add_filter('avf_avia_builder_gallery_image_link', 'avia_change_gallery_thumbnail_link', 10, 4); function avia_change_gallery_thumbnail_link($link, $attachment, $atts, $meta) { $custom_url = get_post_meta($attachment->ID, '_gallery_link_url', true); if(!empty($custom_url)) { $link[0] = $custom_url; $link['custom_link_class'] = 'aviaopeninbrowser'; } return $link; }
This works on our end. As you can see on the screenshot the link of the hovered image is google.com, which is the url that we set for the image.
Cheers!
IsmaelFebruary 19, 2014 at 10:57 am #226097I remove and reinstalled the plugin and added your code. And gues what… it works!
Thanks dude. :-)
Regards,
David
-
AuthorPosts
- The topic ‘adding links to a gallery’ is closed to new replies.