Make WordPress Core

Opened 9 years ago

Closed 7 years ago

#6368 closed enhancement (fixed)

Gallery display enhancements

Reported by: tellyworth Owned by: matt
Milestone: 2.8 Priority: normal
Severity: normal Version:
Component: Gallery Keywords: has-patch
Focuses: Cc:


This makes the [gallery] output more configurable and useful. Changes include:

  • 'Description' (excerpt) is now 'Caption'
  • Captions are displayed below thumbs in the main gallery display
  • Thumb gallery markup is improved (dl/dd/dt for icon and caption display, tags are configurable by attributes like [gallery itemtag="div"] if necessary)
  • Parent id is selectable, e.g. [gallery id=123]
  • Icon size is selectable, [gallery size="medium"]
  • Column count is selectable, [gallery columns=4]
  • Order is selectable, [gallery orderby="post_title"]

I think some of these attributes should have a UI, where you click on the Insert Gallery Into Post button, but that's not included in this patch.

The dl/dd/dt method of marking up images with captions is discussed and recommended here:


Attachments (2)

gallery-improvements-r7493.patch (3.9 KB) - added by tellyworth 9 years ago.
gallery-improvements-r7493-2.patch (4.5 KB) - added by tellyworth 9 years ago.

Download all attachments as: .zip

Change History (13)

#1 @ryan
9 years ago

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

(In [7496]) Gallery display enhancements from tellyworth. fixes #6368

#2 @DD32
9 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

after [7496], when i insert a gallery into a post, i get this:

Fatal error: Call to undefined function tag_escape() in C:\www\wordpress\wp-includes\media.php on line 367

#3 @matt
9 years ago


#4 @tellyworth
9 years ago

Sorry, missed a file out of the patch. The second version should fix it.

#5 @matt
9 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [7497]) Bring in forgotton tag_escape. Fixes #6368.

#6 @alastc
8 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

I have to disagree with using definition lists in the gallery, a list of one does not make sense, either logically or how HTML is intended to be used.

For example, assistive technologies like screen readers provide navigation short-cuts for lists (and headings, links etc). So you would get to a gallery, and oh, it's a list, great. I'm not that interested in the list so you try and skip over it... to another list, and another etc.

The reason I re-opened this bug rather than just rely on [bug 6927] is that the 'itemtag' option doesn't allow you to use, for example, a proper list. I.e. where the gallery is a list (e.g. ul) and each item is a list item (li).

Would it be possible to change this to defining the top item (e.g. dl, ul, div), and have the function automatically pick the right per-image element? (e.g. dt, li, div).

At the moment I've hacked together a gallery shortcode replacement to output simplified code (including alt text), but it is a hack (I'm not a programmer), it would be better if the core could output accessible code by default.

I included two examples of desired output here:

I'm happy to work on the front-end code stuff, but I'm not the person for PHP changes...

#7 @thee17
8 years ago

  • Milestone changed from 2.5 to 2.7

#8 @ryan
8 years ago

  • Milestone changed from 2.7 to 2.8

Moving enhancements to 2.8.

#9 @ryan
8 years ago

  • Component changed from General to Gallery

#10 @ShaneF
8 years ago

  • Milestone changed from 2.8 to 2.9

Moving enhancements to 2.9.

#11 @Denis-de-Bernardy
7 years ago

  • Milestone changed from 2.9 to 2.8
  • Resolution set to fixed
  • Status changed from reopened to closed

Fixed since r7497. Please open a separate ticket (with a patch) for the definition list issue.

Note: See TracTickets for help on using tickets.