Opened 23 months ago

Last modified 7 weeks ago

#18178 new enhancement

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

Reported by: chipbennett Owned by:
Priority: normal Milestone: 3.6
Component: Gallery Version: 3.2.1
Severity: normal Keywords: has-patch needs-testing
Cc: MHagemeister, helgatheviking@…, marcel@…

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 (4)

media.php.galleryshortcodelinknone.diff (1.4 KB) - added by chipbennett 23 months 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 4 months ago.
supports link=none, same as Chip's version, but newer
18178.diff (1.2 KB) - added by wonderboymusic 4 months ago.
gallery-no-link.18178a.diff (2.5 KB) - added by helgatheviking 3 months ago.
Add "none" option to dropdown on gallery pop-up window

Download all attachments as: .zip

Change History (14)

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

  • Keywords has-patch needs-testing added

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

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

Last edited 4 months ago by MHagemeister (previous) (diff)
  • Cc MHagemeister added
  • Cc helgatheviking@… added

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

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

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.

I'll refresh the patch - probably tonight.

  • 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

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.

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

  • Cc marcel@… added
Note: See TracTickets for help on using tickets.