WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 23 months 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
Milestone: 3.6 Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: has-patch
Focuses: 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 2 years ago.
23617.1.diff (3.0 KB) - added by lancewillett 2 years ago.
Move to function, provide fallback for missing IDs
23617.2.diff (2.9 KB) - added by lancewillett 2 years ago.
23617.3.diff (635 bytes) - added by kovshenin 23 months ago.

Download all attachments as: .zip

Change History (17)

comment:1 @lancewillett2 years ago

  • Milestone changed from WordPress.org to 3.6

@obenland2 years ago

comment:2 @obenland2 years ago

  • Keywords has-patch added; needs-patch removed

comment:3 @lancewillett2 years ago

  • 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: @lancewillett2 years 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 @lancewillett2 years 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.

comment:6 @lancewillett2 years ago

  • 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 2 years ago by lancewillett (previous) (diff)

comment:7 @obenland2 years ago

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.

comment:8 @lancewillett2 years ago

Cool. Works for me, then.

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

@lancewillett2 years ago

Move to function, provide fallback for missing IDs

comment:9 @lancewillett2 years ago

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

@lancewillett2 years ago

comment:10 @lancewillett2 years ago

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

comment:11 @lancewillett2 years ago

  • 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.

@kovshenin23 months ago

comment:12 @kovshenin23 months ago

  • 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.

comment:13 @lancewillett23 months ago

  • 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.