Make WordPress Core

Opened 4 years ago

Closed 2 years ago

Last modified 2 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:


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 4 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 2 years ago.

Download all attachments as: .zip

Change History (19)

@chipbennett4 years ago

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

comment:1 @chipbennett4 years ago

  • Keywords has-patch needs-testing added

comment:2 @helgatheviking3 years ago

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

comment:3 @MHagemeister3 years ago

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

Version 0, edited 3 years ago by MHagemeister (next)

comment:4 @MHagemeister3 years ago

  • Cc MHagemeister added

comment:5 @helgatheviking3 years ago

  • Cc helgatheviking@… added

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

@helgatheviking3 years ago

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

comment:6 @helgatheviking3 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.

comment:7 @chipbennett3 years ago

I'll refresh the patch - probably tonight.

@wonderboymusic3 years ago

comment:8 @wonderboymusic3 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

comment:9 @mdgl3 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.

@helgatheviking3 years ago

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

comment:10 @macbrink3 years ago

  • Cc marcel@… added

@aaroncampbell2 years ago

comment:11 @aaroncampbell2 years ago

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

comment:12 @nacin2 years ago

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

comment:13 @nacin2 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.

comment:14 @nacin2 years ago

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