Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I add links to images within a gallery so the image is clickable? #8929

Closed
Clemsou opened this issue Aug 13, 2018 · 7 comments
Closed
Labels
[Feature] Blocks Overall functionality of blocks [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Type] Enhancement A suggestion for improvement.

Comments

@Clemsou
Copy link

Clemsou commented Aug 13, 2018

I'm trying to add links to images within a gallery so the image is clickable and links to an internal page or an external site. I found how to add a link on each image but it appear written on the images when I want it hidden so it looks more aesthetic. Is there a way to do this?

@Clemsou Clemsou changed the title I'm trying to add links to images within a gallery so the image is clickable and links to an internal page or an external site. I found how to add a link on each image but it appear written on the images when I want them hidden so it looks more aesthetic. Is there a way to do this? I'm trying to add links to images within a gallery so the image is clickable and links to an internal page or an external site. I found how to add a link on each image but it appear written on the images when I want it hidden so it looks more aesthetic. Is there a way to do this? Aug 13, 2018
@designsimply designsimply changed the title I'm trying to add links to images within a gallery so the image is clickable and links to an internal page or an external site. I found how to add a link on each image but it appear written on the images when I want it hidden so it looks more aesthetic. Is there a way to do this? How do I add links to images within a gallery so the image is clickable? Aug 13, 2018
@designsimply designsimply added [Type] Enhancement A suggestion for improvement. [Feature] Blocks Overall functionality of blocks [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed labels Aug 13, 2018
@designsimply
Copy link
Member

Hi @Clemsou! Thank you for your question. There is not currently a way to add links to images within a gallery, and there is a long-standing request for that in the core WordPress project at https://core.trac.wordpress.org/ticket/13429

I am going to close this issue a duplicate since there is already a feature request open for it. If you would like to add your voice to the exiting feature request, please add your vote and optionally post a little bit of detail about why you are trying to add links to gallery images and why it is important to you at https://wordpress.org/ideas/topic/custom-links-on-images-within-a-gallery

If you have future questions about how Gutenberg works, can you please post at https://wordpress.org/support/plugin/gutenberg to ask there first? It will help us to keep this area streamlined and support forums are the recommended first place to ask for help with how to use the editor or if a feature has already been requested or not. Thank you so much and thanks for testing Gutenberg and asking questions!

@designsimply
Copy link
Member

@joostmollerus you could do it by adding the images to a table or a columns block. If you need help or have questions about implementing something like that, please ask for help in the forums at https://wordpress.org/support/forum/how-to-and-troubleshooting/.

@sasserc
Copy link

sasserc commented Apr 18, 2019

Although tedious, but simple (even for a non-developer), if you insert a gallery block and add gallery images and then set number of columns for block and set link to: "Attachments", you can then go to the block and "edit in html" and just replace the href=urls on each image with the link you want plus _target="blank" if you want to open in new tab, etc. For a small gallery, it is not too bad but they do need to fix this.

@vilian
Copy link

vilian commented May 10, 2019

I've had success wrapping the gallery's <figure> tags in <a> tags.

@sasserc
Copy link

sasserc commented May 16, 2019

I found a plugin that will do this: https://wordpress.org/plugins/gallery-custom-links/ and I also discovered I had another premium plugin I was already using that does this. WP Media Folders which is an awesome plugin to create folders in the media library and you can delete the plugin and everything goes back to normal. https://www.joomunited.com/wordpress-products/wp-media-folder

One thing to keep in mind when assigning a link to the image is that anywhere you use that image it will contain the link which may be the behavior you want or maybe not. If not just create a second image with a different name.

@Romanskull
Copy link

Although tedious, but simple (even for a non-developer), if you insert a gallery block and add gallery images and then set number of columns for block and set link to: "Attachments", you can then go to the block and "edit in html" and just replace the href=urls on each image with the link you want plus _target="blank" if you want to open in new tab, etc. For a small gallery, it is not too bad but they do need to fix this.

sasserc - this worked great - thank you!

@VonZubinski
Copy link

The wordpress team seems to be working on a solution right now #25940

For a temporary workaround you can use @sasserc 's method above or one of the jQuery and CSS solutions mentioned here
jQuery #10057 (comment)
CSS #10057 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

6 participants