Opened 3 months ago

Closed 11 days ago

#23617 closed defect (bug) (fixed)

Twenty Ten: retrofit with "get first gallery image" technique for gallery post format

Reported by: lancewillett Owned by: lancewillett
Priority: normal Milestone: 3.6
Component: Bundled Theme Version:
Severity: normal Keywords: has-patch
Cc:

Description

The goal is to replace the custom code in loop.php with a simpler, cleaner core function. Will probably need to provide back compat fallback for pre 3.6 versions, though.

See #22960 for the new image grabber function and #15385 for converting Twenty Ten to using get_template_part().

Attachments (4)

23617.diff (1.7 KB) - added by obenland 8 weeks ago.
23617.1.diff (3.0 KB) - added by lancewillett 8 weeks ago.
Move to function, provide fallback for missing IDs
23617.2.diff (2.9 KB) - added by lancewillett 7 weeks ago.
23617.3.diff (635 bytes) - added by kovshenin 12 days ago.

Download all attachments as: .zip

Change History (17)

  • Milestone changed from WordPress.org to 3.6
  • Keywords has-patch added; needs-patch removed
  • Keywords needs-testing added

My comment in http://core.trac.wordpress.org/ticket/22907#comment:4 applies here, too. What back compat do we need to test, and can the code be moved into a function to keep the template file cleaner?

comment:4 follow-up: ↓ 5   lancewillett8 weeks ago

Quick test with 3.4.2 and Twenty Ten. Created a new gallery post, pasted in [gallery ids="619,618,617"] as the content (grabbed 3 IDs from Media Library).

Works great on index, no errors. On single, the view is empty, though.

Tested with 3.5.1 and Twenty Ten, same post content. Exact opposite result: looks great on single, but empty view on index.

comment:5 in reply to: ↑ 4   lancewillett8 weeks ago

Replying to lancewillett:

Tested with 3.5.1 and Twenty Ten, same post content. Exact opposite result: looks great on single, but empty view on index.

Scratch that, this was with 3.6 trunk latest.

  • Keywords needs-testing removed

Tests out great in 3.5.1 and 3.6 (previously I didn't have the patch attached correctly).

3.4.2 -- gallery is missing the images on single view (index looks fine).

Last edited 8 weeks ago by lancewillett (previous) (diff)

Patch doesn't tough the single view though. In 3.4 only images attached to the post were working with the gallery shortcode. The ability to add other pictures was just added in 3.5.

Cool. Works for me, then.

Thoughts on moving to a function instead of code right in the template?

Move to function, provide fallback for missing IDs

.1 moves to functions.php to simplify the template file a bit, and provides better fallback for shortcodes without "ids" attributes.

.2 patch fixes comment block for accuracy for new function and changes function to always return an array value.

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

In 23826:

Twenty Ten: improve how gallery image IDs are retrieved for use in the Gallery post format template. Props to obenland for original patch, fixes #23617.

  • Resolution fixed deleted
  • Status changed from closed to reopened

[24093] introduced a new $html argument to get_post_galleries which defaults to true and breaks gallery counts (displays always 1 without a thumbnail). 23617.3.diff addresses this, and also changes the function we check in function_exists to the one that is actually used.

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

In 24195:

Twenty Ten: call get_post_galleries() correctly now that it has new arguments, and use a more accurate function_exists call. Props kovshenin, closes #23617.

Note: See TracTickets for help on using tickets.