WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 6 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:

Description

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:

http://www.dzr-web.com/people/darren/blog/2005/02/09/image-captions-in-xhtml/
http://www.tjkdesign.com/articles/how_to_style_thumbnail_and_caption.asp

Attachments (2)

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

Download all attachments as: .zip

Change History (13)

comment:1 @ryan7 years ago

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

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

comment:2 @DD327 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

comment:3 @matt7 years ago

Confirmed.

comment:4 @tellyworth7 years ago

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

comment:5 @matt7 years ago

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

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

comment:6 @alastc7 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:
http://alastairc.ac/notes/web-applications/wordpress/clean-gallery/#code-changes

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

comment:7 @thee177 years ago

  • Milestone changed from 2.5 to 2.7

comment:8 @ryan7 years ago

  • Milestone changed from 2.7 to 2.8

Moving enhancements to 2.8.

comment:9 @ryan6 years ago

  • Component changed from General to Gallery

comment:10 @ShaneF6 years ago

  • Milestone changed from 2.8 to 2.9

Moving enhancements to 2.9.

comment:11 @Denis-de-Bernardy6 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.