WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 3 years ago

Last modified 3 years ago

#18178 closed enhancement (fixed)

Add "none" option to $attr['link'] for [gallery] shortcode

Reported by: chipbennett Owned by: nacin
Milestone: 3.6 Priority: normal
Severity: normal Version: 3.2.1
Component: Gallery Keywords: has-patch needs-testing
Focuses: Cc:

Description

Currently, the [gallery] shortcode only supports output of linked images. By default, each gallery image links to the attachment page, or directly to the file, if link="file" is passed to the shortcode. Both cases use wp_get_attachment_image_link().

Attached patch adds support for link="none", enabling the gallery images to be output as flat image files, rather than linked, via wp_get_attachment_image().

Attachments (5)

media.php.galleryshortcodelinknone.diff (1.4 KB) - added by chipbennett 5 years ago.
Add link="none" support to [gallery] shortcode, to enable output of flat/unlinked images
gallery-no-link.18178.diff (1.4 KB) - added by helgatheviking 3 years ago.
supports link=none, same as Chip's version, but newer
18178.diff (1.2 KB) - added by wonderboymusic 3 years ago.
gallery-no-link.18178a.diff (2.5 KB) - added by helgatheviking 3 years ago.
Add "none" option to dropdown on gallery pop-up window
18178.2.diff (1.5 KB) - added by aaroncampbell 3 years ago.

Download all attachments as: .zip

Change History (19)

@chipbennett
5 years ago

Add link="none" support to [gallery] shortcode, to enable output of flat/unlinked images

#1 @chipbennett
5 years ago

  • Keywords has-patch needs-testing added

#2 @helgatheviking
4 years ago

+1 for this feature. is this going to be integrated at some point?

#3 @MHagemeister
3 years ago

+1 Need it for the next version of my photography site, where I use the gallery shortcode to display full size images.

Last edited 3 years ago by MHagemeister (previous) (diff)

#4 @MHagemeister
3 years ago

  • Cc MHagemeister added

#5 @helgatheviking
3 years ago

  • Cc helgatheviking@… added

Is there anything I can do to get Chip's patch moved along towards core?

@helgatheviking
3 years ago

supports link=none, same as Chip's version, but newer

#6 @helgatheviking
3 years ago

Just to verify that Chip's patch still works perfectly over a year later. I got some error about line numbers not matching up any more (I use git) and so I just created a new version of the same diff.... don't know if it is needed or not. Ultimately, Chip's approach works great and I think would be worth including in the next update.

#7 @chipbennett
3 years ago

I'll refresh the patch - probably tonight.

@wonderboymusic
3 years ago

#8 @wonderboymusic
3 years ago

  • Milestone changed from Awaiting Review to 3.6

This seems harmless - I tidy'd up the code a lil bit, but it's all based on your patches. wp_get_attachement_* funcs are documented themselves, so I don't think we need to go into great detail about what is going down here

#9 @mdgl
3 years ago

Please let's not forget that galleries in feeds are handled by a slightly different code path and may also need some attention. See #22101.

@helgatheviking
3 years ago

Add "none" option to dropdown on gallery pop-up window

#10 @macbrink
3 years ago

  • Cc marcel@… added

#11 @aaroncampbell
3 years ago

18178.2.diff cleans up the code a bit more and updates to apply cleanly.

#12 @nacin
3 years ago

  • Keywords 3.7-early added
  • Milestone changed from 3.6 to Future Release

#13 @nacin
3 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 24550:

Allow gallery to be inserted with no links on the images. props chipbennett, helgatheviking, aaroncampbell, wonderboymusic. fixes #18178.

#14 @nacin
3 years ago

  • Keywords 3.7-early removed
  • Milestone changed from Future Release to 3.6
Note: See TracTickets for help on using tickets.