WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#25537 closed defect (bug) (fixed)

get_post_gallery() adds duplicate <br to the end, resulting in extra blank space

Reported by: sgr33n Owned by: drozdz
Milestone: 3.9 Priority: normal
Severity: normal Version:
Component: Gallery Keywords: good-first-bug has-patch commit
Focuses: Cc:

Description

Using get_post_gallery() adds duplicate <br to the end, resulting in extra blank space.

Attachments (3)

get_post_gallery.png (5.1 KB) - added by sgr33n 7 years ago.
Resulting code
get_post_gallery_TEST.htm (8.3 KB) - added by Shelob9 7 years ago.
Results of tests described in comment #2 showing when the issue happens and doesn't happen.
25537.patch (444 bytes) - added by drozdz 7 years ago.
Proposed patch for Ticket #25537

Download all attachments as: .zip

Change History (15)

@sgr33n
7 years ago

Resulting code

#1 @nacin
7 years ago

  • Component changed from General to Gallery
  • Milestone changed from Awaiting Review to 3.9

#2 @Shelob9
7 years ago

I tried to reproduce this issue and am able to reproduce it only if the last row of the gallery is full.

I first created a gallery of 5 images, 3 wide and tested by creating a gallery in a post and outputting it with the gallery shortcode and doing echo get_post_gallery( 1704 ); in debug. In both cases I got just one <br style="clear: both;"> at the end of each row. I then added a sixth image to the gallery and got the additional <br style="clear: both;"> that @sgr33n reports.

For reference, I am attaching an html file of the results of my 4 tests.

I am testing using 3.9-alpha pulled from trunk at ~2100UTC today (January 19 2014.)

@Shelob9
7 years ago

Results of tests described in comment #2 showing when the issue happens and doesn't happen.

#3 @nacin
7 years ago

  • Keywords needs-patch good-first-bug added

@drozdz
7 years ago

Proposed patch for Ticket #25537

#4 @drozdz
7 years ago

  • Keywords has-patch added; needs-patch removed

#5 @nacin
7 years ago

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

Looks good drozdz, thanks!

#6 @bcworkz
7 years ago

#26958 was marked as a duplicate.

#7 @samuelsidler
6 years ago

  • Keywords commit added

This ticket was mentioned in IRC in #wordpress-dev by nacin. View the logs.


6 years ago

#9 @nacin
6 years ago

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

In 27800:

Galleries: Avoid doubling up clearing br elements.

props drozdz.
fixes #25537.

#10 @mmcginnis
6 years ago

Not sure if this is the right place to comment, but I'd love to +1 the option of ditching the <br style='clear:both;' /> tags altogether.

#11 @GaryJ
6 years ago

Could the line break markup be wrapped in a filter, so we could __return_empty() if we know a theme is happy to apply the relevant CSS itself?

#12 @dway
6 years ago

Yep, this is a great idea regarding that this markup is useless for semantic purpose, and will be then backward compatible.
Should we reopen this ?

Note: See TracTickets for help on using tickets.