Make WordPress Core

Opened 22 months ago

Last modified 6 weeks ago

#42549 assigned enhancement

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

Reported by: westonruter Owned by: audrasjb
Milestone: 5.3 Priority: normal
Severity: normal Version: 4.9
Component: Widgets Keywords: has-patch has-screenshots commit
Focuses: Cc:


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 22 months ago.
42549.1.diff (930 bytes) - added by audrasjb 6 weeks ago.
Patch refreshed
Capture d’écran 2019-08-01 à 21.34.01.png (169.8 KB) - added by audrasjb 6 weeks ago.
Tested and works fine

Download all attachments as: .zip

Change History (13)

#1 @westonruter
22 months 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
22 months ago

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

#3 @johnbillion
11 months ago

  • Milestone changed from 5.0 to 5.1

#4 @pento
8 months ago

  • Milestone changed from 5.1 to Future Release

#5 @audrasjb
7 months ago

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

Let's address this feature in 5.2

#6 @desrosj
6 months 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
6 months 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
4 months ago

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

#9 @audrasjb
6 weeks ago

  • Keywords needs-screenshots needs-refresh added

Needs refresh and coding standards changes.

6 weeks ago

Patch refreshed

6 weeks ago

Tested and works fine

#10 @audrasjb
6 weeks 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.


Note: See TracTickets for help on using tickets.