Make WordPress Core

Opened 7 years ago

Last modified 4 years ago

#42549 assigned enhancement

Widgets: Allow gallery widget to display images from currently-queried singular post if no images selected

Reported by: westonruter's profile westonruter Owned by: audrasjb's profile audrasjb
Milestone: Future Release Priority: normal
Severity: normal Version: 4.9
Component: Widgets Keywords: has-patch has-screenshots needs-unit-tests
Focuses: Cc:

Description

In #42548 (pending) a [gallery] placed inside of a Text widget will result in the attachments for a given post to be used in the gallery when the widget appears on a singular template. The same behavior could be allowed for the Gallery widget as well. If you add a gallery widget to a sidebar but don't add any images to it, the widget could conditionally show if it is being rendered on a singular template for a post that has image attachments.

Attachments (3)

42549.0.diff (908 bytes) - added by westonruter 7 years ago.
42549.1.diff (930 bytes) - added by audrasjb 5 years ago.
Patch refreshed
Capture d’écran 2019-08-01 à 21.34.01.png (169.8 KB) - added by audrasjb 5 years ago.
Tested and works fine

Download all attachments as: .zip

Change History (17)

@westonruter
7 years ago

#1 @westonruter
7 years ago

  • Keywords has-patch added

There may need to be a way to clear a gallery of its selected images. Currently once you select an image, you cannot reset the gallery to be empty without deleting the gallery widget and adding one in its place.

#2 @westonruter
7 years ago

  • Keywords 2nd-opinion added
  • Milestone changed from 4.9.1 to 5.0

#3 @johnbillion
6 years ago

  • Milestone changed from 5.0 to 5.1

#4 @pento
6 years ago

  • Milestone changed from 5.1 to Future Release

#5 @audrasjb
5 years ago

  • Keywords 2nd-opinion removed
  • Milestone changed from Future Release to 5.2

Let's address this feature in 5.2

#6 @desrosj
5 years ago

  • Keywords needs-testing added

Going to punt this since 5.2 beta 1 is in less than 2 days. @audrasjb if you are able to get this ready by beta, feel free to move it back.

#7 @audrasjb
5 years ago

  • Milestone changed from 5.2 to 5.3

The timeframe is too short to have testing on this on, so I'm inclined to punt the ticket to 5.3.

#8 @audrasjb
5 years ago

  • Owner set to audrasjb
  • Status changed from new to assigned

#9 @audrasjb
5 years ago

  • Keywords needs-screenshots needs-refresh added

Needs refresh and coding standards changes.

@audrasjb
5 years ago

Patch refreshed

@audrasjb
5 years ago

Tested and works fine

#10 @audrasjb
5 years ago

  • Keywords has-screenshots commit added; needs-testing needs-screenshots needs-refresh removed

Hi there,

I refreshed the initial patch and I fixed some coding standards issues.
42549.1.diff looks good to go on my side (see screenshot above). On singular posts that have attached media images, the widget fallback displays those images. On any other pages (archives, posts without attached images, etc.) the widget is not displayed.

Cheers,
Jb

#11 @desrosj
5 years ago

  • Keywords needs-unit-tests added; commit removed

@audrasjb Thanks for working on this one!

The patch itself looks good. It wouldn't hurt to get some unit tests, though.

Also, the concern stated in ticket:42549#comment:1 still exists. Wondering if there should be a clear button there to make this easier.

#12 @desrosj
5 years ago

  • Milestone changed from 5.3 to 5.4

With 5.3 beta 1 in a few hours, I'm going to punt this one.

#13 @audrasjb
4 years ago

  • Milestone changed from 5.4 to Future Release
  • Owner audrasjb deleted

Punting to Future release as we don't have time to handle this in the next few days.

#14 @audrasjb
4 years ago

  • Owner set to audrasjb
Note: See TracTickets for help on using tickets.