#23298 closed defect (bug) (fixed)
Initial gallery 'Link to' setting not applied
Reported by: | pokes | Owned by: | ryan |
---|---|---|---|
Milestone: | 3.5.2 | Priority: | normal |
Severity: | normal | Version: | 3.5.1 |
Component: | Gallery | Keywords: | has-patch commit |
Focuses: | Cc: |
Description (last modified by )
When inserting a new gallery in a post, the setting shown in the 'Link to' dropdown of the gallery settings is not applied. Changing the setting (even straight back to what it showed) causes it to be applied.
To demonstrate/reproduce:
- New Post.
- Add Media.
- Create Gallery.
- Create a New Gallery.
- Under Gallery Settings observe but don't touch the 'Link to' setting.
- Insert Gallery.
- Resulting gallery shortcode has no link=file or link=post regardless of the 'Link to' setting.
Attachments (3)
Change History (46)
#1
@
12 years ago
I can confirm the bug reported by Pokes using Twelve Eleven with no plugins active.
If you generate a new Gallery using either freshly uploaded images, or existing images previously uploaded, and set the link to "Media File", it's dropping the link="file" rom teh shortcode. You end up with [gallery ids="1,2,3,4"].
During the Gallery generation step, or when editing the gallery after saving, if you toggle from link to "Media File" to link to "Attachment Page" and then back to link to "Media File", now the correct short code of [gallery link="file" ids="1,2,3,4"] is generated.
Cheers!
#5
@
12 years ago
23298.patch makes "Attachment Page" the default value, since it's actually the default behaviour of gallery_shortcode()
, and declares it as such in wp.media.gallery.defaults
.
We should probably also explicitly declare it in gallery_shortcode()
defaults.
#7
in reply to:
↑ 6
;
follow-up:
↓ 10
@
12 years ago
Replying to nacin:
Is this a problem in 3.5.0? I imagine not, then?
I can reproduce the bug on 3.5. It defaults to no link
attribute without deliberately switching the option first.
- Create gallery, leave as 'Attachment Page', get
[gallery ids="1,2,3"]
- Edit gallery, change to 'Image Link', get
[gallery link="file" ids="1,2,3"]
- Edit gallery again, change to 'Attachment Page', get
[gallery link="post" ids="1,2,3]
@SergeyBiryukov: 23298.patch doesn't apply cleanly as the media-template.php additions are already in place in both 3.5 and 3.5.1
#8
@
12 years ago
I should mention that if the dropdown value isn't changed by say, a user setting, to the last-used setting, it's not as big of a deal because absent a link attribute, gallery images default to attachment page links anyway.
#9
in reply to:
↑ 6
@
12 years ago
- Keywords needs-patch added
Replying to nacin:
Is this a problem in 3.5.0? I imagine not, then?
The symptoms in 3.5.0 and 3.5.1 are different.
In 3.5.0, the (minor) issue is just that the default value (link="post"
) is not always removed from the shortcode as it should per [22715], since it's not explicitly declared in wp.media.gallery.defaults
.
In 3.5.1, the (bigger) issue is that the default value (link="file"
) is not respected, unless you toggle the dropdown from "Media File" to "Attachment Page" and back. This was introduced in [23262].
Now I see that linking to media files as the default was intentional in [23262]. 23298.patch reverts that, so I guess a new patch is needed.
#10
in reply to:
↑ 7
@
12 years ago
Replying to DrewAPicture:
23298.patch doesn't apply cleanly as the media-template.php additions are already in place in both 3.5 and 3.5.1
Only in 3.5, see the changes in [23262].
#11
follow-up:
↓ 26
@
12 years ago
I can also confirm problem in my installation of wordpress 3.5.1. It's odd, that when I select "Attachment Page" and than select back "Media File", the link="file" attribute is inserted well. But when I leave default "Media File" selected, it doesn't work. It seems, that there is same where missing default attribute in js, to insert link="file".
#12
@
12 years ago
- Version changed from 3.5 to 3.5.1
[23262] may have been done in error for galleries. The default for images is linking to the file; the default for galleries is linking to the attachment page. I didn't catch the latter, making [23262] a bit overzealous (which I realized, and is why I immediately questioned 3.5 versus 3.5.1 behavior). 23298.patch is therefore probably the correct fix.
#14
follow-ups:
↓ 15
↓ 19
@
12 years ago
Probably isn't the place, but you should be able to have a link="none" where the gallery images don't link anywhere.
#15
in reply to:
↑ 14
@
12 years ago
Replying to helgatheviking:
Probably isn't the place, but you should be able to have a link="none" where the gallery images don't link anywhere.
I agree . and it is probably not the right place either , but while already meddling with the code , should´t there be also a "custom URL" option at this very same place ?
#16
follow-up:
↓ 18
@
12 years ago
in the gallery shortcode, if you replace:
$link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
with
if ( isset($attr['link']) && 'none' == $attr['link'] ) { $link = wp_get_attachment_image($id, $size, false, false); } elseif ( isset($attr['link']) && 'file' == $attr['link'] ) { $link = wp_get_attachment_link($id, $size, false, false); } else { $link = wp_get_attachment_link($id, $size, true, false); }
a non-linking gallery is easily accomplished.
@krembo99 - I think a custom URL would be a lot more difficult to accomplish. Does every image link to the custom URL? Or does each image have a custom URL?
#18
in reply to:
↑ 16
@
12 years ago
- Cc krembo99 added
Replying to helgatheviking:
@krembo99 - I think a custom URL would be a lot more difficult to accomplish. Does every image link to the custom URL? Or does each image have a custom URL?
When one uploads an image , there is already a custom URL option "Allows you to set a custom link URL for your inserted image to link to when clicked".
This option however , even when set upon upload, is not available when using said image in a gallery shortcode. IMHO it should be . It will allow a much desired flexibility to the gallery shortcode (just imagine a "posts gallery" ).
But like I mentioned before , it might not be the right place to mention it , and it might require a new enhancement ticket.
(This option is possibly achieved with some plugin / core modifications seen for example HERE)
#19
in reply to:
↑ 14
;
follow-up:
↓ 20
@
12 years ago
Replying to helgatheviking:
Probably isn't the place, but you should be able to have a link="none" where the gallery images don't link anywhere.
Related: #18178
#20
in reply to:
↑ 19
;
follow-up:
↓ 23
@
12 years ago
Replying to SergeyBiryukov:
Replying to helgatheviking:
Probably isn't the place, but you should be able to have a link="none" where the gallery images don't link anywhere.
Related: #18178
How do you do that!? I even posted on the other ticket and couldn't find it again. Then, I can't find anything in trac.
#21
@
12 years ago
@krembo - I don't think that link URL is saved anywhere, so you can't use it in the gallery shortcode.
Back to the initial ticket, I can confirm this on 3.5.1 as well.
#23
in reply to:
↑ 20
@
12 years ago
Replying to helgatheviking:
How do you do that!? I even posted on the other ticket and couldn't find it again. Then, I can't find anything in trac.
Google site search is your friend :)
site:core.trac.wordpress.org search terms
#24
@
12 years ago
- Cc glrss added
I've noticed the same thing with 3.5.1 on installations I manage and also on WordPress.com.
#26
in reply to:
↑ 11
@
12 years ago
Hey Guys/Gals,
I'm still a little confused as to how I can set link="file" as the default value for galleries? I have no use for the link to attachments for single images or galleries.
Does anybody know how best to achieve this?
Thanks in advance,
Paul
Replying to danix1:
I can also confirm problem in my installation of wordpress 3.5.1. It's odd, that when I select "Attachment Page" and than select back "Media File", the link="file" attribute is inserted well. But when I leave default "Media File" selected, it doesn't work. It seems, that there is same where missing default attribute in js, to insert link="file".
#28
follow-up:
↓ 35
@
12 years ago
I agree with you. It's very annoying bug. The bug is still there. That's unbelievable, they don't distribute the new version. I think it's end of the WordPress.
#29
@
12 years ago
Commit added? - Does this mean that the patch is being added for WP 3.5.2 release? It doesn't seem like it's fully resolved and likely be raised again in next release?
Not better to nip it in the bud now?
#35
in reply to:
↑ 28
@
12 years ago
Replying to manyakabi:
I agree with you. It's very annoying bug. The bug is still there. That's unbelievable, they don't distribute the new version. I think it's end of the WordPress.
Seriously? WordPress is a massive project that is provided for your use free of charge. Bugs are constantly reported, features are suggested, and tweaks made to make your use of the platform easier... and you're going to say it's the end of WordPress because of something this inconsequential? Now, I have no direct affiliation with WordPress... in fact, I've yet to submit a patch to core, but this is just silly.
Be thankful that people are willing to dedicate the time and energy to this product to keep it alive. Be thankful that you are being given a solution that is as flexible and extensible as WordPress is for free. Give back to the community through finding bugs, suggesting features, or making otherwise useful comments. Dig into the forums if you have experience with plugins or themes... you'd be surprised how simple some questions are even for a regular user to answer. Dig into the bugtracker if you're a dev... every little bit of development support helps. If you don't think you're competent enough to do either of those things, then start off by reading this and leaving a word of encouragement or thanks to your favorite developer, or a random one, or the community as a whole.
tl;dr: Seriously? Don't complain about a free product that has a minor bug in it. It'll get fixed. Contribute if you can.
</endrant>
#36
@
12 years ago
if you do not need image to be linked to page you can use it: (found at support pages):
If you want to force the link to be directly to the image itself, go to around line 762-ish
where this code appears...
$link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
Change it to just this...
$link = wp_get_attachment_link($id, $size, false, false);
You should get direct links to the big image after that.
regs
#41
@
12 years ago
Patch seem fine for trunk and the 3.5 branch. SergeyBiryukov, do you want to refresh anything with the patch?
Link to Media File