WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 2 months 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 2 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 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 4 months ago.
Add "none" option to dropdown on gallery pop-up window

Download all attachments as: .zip

Change History (14)

chipbennett2 years ago

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

comment:1 chipbennett2 years ago

  • Keywords has-patch needs-testing added

comment:2 helgatheviking12 months ago

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

comment:3 MHagemeister4 months 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 4 months ago by MHagemeister (previous) (diff)

comment:4 MHagemeister4 months ago

  • Cc MHagemeister added

comment:5 helgatheviking4 months ago

  • Cc helgatheviking@… added

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

helgatheviking4 months ago

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

comment:6 helgatheviking4 months 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 chipbennett4 months ago

I'll refresh the patch - probably tonight.

wonderboymusic4 months ago

comment:8 wonderboymusic4 months 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 mdgl4 months 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.

helgatheviking4 months ago

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

comment:10 macbrink2 months ago

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