Opened 12 years ago
Closed 12 years ago
#22907 closed defect (bug) (fixed)
Twenty Eleven: Gallery thumbnail missing in some cases
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.6 | Priority: | normal |
Severity: | normal | Version: | 3.5 |
Component: | Bundled Theme | Keywords: | has-patch |
Focuses: | Cc: |
Description
With new Media came the possibility to create galleries from all uploaded pictures, not only the ones to a specific post. In the edge case that the gallery does not contain at least one image attachment that has the given post as a parent, the query for it comes up empty.
Additionally, as soon as there is one image in the gallerie that does not have the given post as a parent, the image count will be off.
Attachments (5)
Change History (17)
#4
@
12 years ago
- Keywords needs-testing added
@obenland -- what do you think about moving this to a function in functions.php instead? Shouldn't affect back compat.
What are the test cases we need to check, back to 3.3 or 3.4 -- create a gallery and insert it into a different post instead of the parent post?
#5
@
12 years ago
Testing notes:
- 3.6 trunk, gallery post format with just
[gallery]
shortcode is empty on index view (using the Theme Unit Test Data, it's the Post Format Test: Gallery post). Looks as expected on single view. - 3.5.1: using
[gallery ids="619,618,617"]
as test post content -- nothing is visible on index, but the Theme Unit Test post works fine on index. Single working as expected. 3.4.2: no gallery content visible on index or view withThis is OK.[gallery ids="619,618,617"]
as test post content -- both views are empty.
#6
@
12 years ago
So I figured out why the 3.5.1 and 3.6 cases don't work -- this solution depends on ids
attribute being set in the shortcode.
If that's an OK assumption (since 3.5+ adding a gallery to content should add the IDs also) -- we can go with it.
Otherwise, we should catch that in the code -- if after checking with get_post_galleries()
and the $images
array is still empty -- go with the fallback that uses {get_posts()
.
#7
@
12 years ago
.2 moves to functions.php to simplify the template file, and also provides the get_posts()
call as a fallback even if 'get_post_gallery_images' exists (for the case it fails to get any IDs back).
#8
@
12 years ago
- Keywords needs-testing removed
Tested in 3.4.2, 3.5.1, and 3.6 trunk. Works now for both "bare" gallery shortcode with no attributes, and for shortcode with "ids" attributes.
#9
@
12 years ago
Patch updates comment block for accuracy for new function, and also returns only array value instead of mixed.
#10
@
12 years ago
- Owner set to lancewillett
- Resolution set to fixed
- Status changed from new to closed
In 23824:
#11
@
12 years 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). 22907.3.diff addresses this, and also changes the function we check in function_exists
to the one that is actually used.
Same in Twenty Ten.
I think it'd be cool to make this a core function — moving all this code out of this one theme and into a function that *any* theme could use.