Specify custom links for WordPress gallery images (instead of attachment or file only).
Possibly. WP Gallery Custom Links plugin was designed for use with 1) WordPress's [gallery] shortcode and 2) images uploaded through the WordPress media manager. Some themes use these features, and others have their own proprietary way of saving gallery images and drawing out the gallery. Provided your theme meets the criteria above, the plugin should work with it. You might also want to see #6 below.
No, this plugin is not compatible with NextGen galleries. WP Gallery Custom Links was designed for use with 1) WordPress's [gallery] shortcode and 2) images uploaded through the WordPress media manager. NextGen galleries uses its own [nggallery] etc. shortcodes that function outside of the WordPress [gallery] shortcode.
The way the plugin works requires the gallery generation code to be run twice. This may result in it being labeled as "#gallery-2" instead of "#gallery-1." Check your HTML and CSS for these changes and adjust accordingly.
The custom links are stored as meta values for images, and can be accessed with the following:
$custom_url = get_post_meta( $attachment_id, '_gallery_link_url', true );
Please note that "$attachment_id" is a variable for the post ID of the image - you will need to have already defined and set this variable in your own code and use your variable in this spot. "$attachment_id" is just an example of what it could be named.
Version 1.9 (hopefully) resolves most of these issues, but if you're still having this problem, see #5 in the old version's readme file here: http://plugins.svn.wordpress.org/wp-gallery-custom-links/tags/1.8.0/readme.txt.
Thing to try #0.5: make sure your gallery is using the [gallery] shortcode (i.e. you've created the gallery by clicking the "Add Media" button and then "Create Gallery" on the side of the media pop-up window). If you don't see a [gallery] shortcode in your content and/or you've created the gallery by using a custom form or shortcode generated by your theme (e.g. "I selected 'Gallery' as a page template option in a dropdown" or "I'm seeing [somethemename_gallery] in my content"), chances are this plugin will not work with that custom code - you would need to contact the author of that custom code to request they add their own version of custom links that will work with their code.
Thing to try #1: make sure your gallery is set to use either attachment or file links. If the gallery is set to link to "none" there will be no links to match on, thus this plugin won't be able to swap in custom values.
Thing to try #2: make sure you have the onclick effect set to "remove" if you continue to have undesired lightbox/carousel popups.
$output = apply_filters('post_gallery', '', $attr); if ( $output != '' ) return $output;
You may want to see http://wordpress.org/support/topic/wont-work-syntax-error for an example of adding this code.
This thing to try is a bit on the programmy side, so if you're having trouble, my suggestion would be to contact your theme author and ask that they support the "post_gallery" filter in their gallery shortcode function. This would not only fix it for your theme most thoroughly, but would also fix it for any future users also using that same theme. Otherwise, any WordPress developer should be able to help you with the code changes to customize your theme to support the post_gallery filter like WordPress core (not something I consider in the realm of free support, sorry).
This plugin just changes links, plus a bit of auxiliary functionality to help with changing the links. It
doesn't alter layout or styling - that's something you'd need to change in your theme or whatever
plugin you may be using to display the gallery. Note: if you're using [none] to remove links from gallery
images, it may affect the styling, depending on whether your stylesheet is expecting all gallery images
<a> tags around them, in which case you would need to modify your stylesheet to also apply
the same styles to
<img> tags without a link around them.
Requires: 3.3.1 or higher
Compatible up to: 3.9.1
Last Updated: 2014-5-29
1 of 9 support threads in the last two months have been resolved.
Got something to say? Need help?