WordPress.org

Make WordPress Core

Opened 15 months ago

Closed 8 months ago

Last modified 7 months ago

#20346 closed enhancement (fixed)

Improve layout of Appearance > Header with flexible-height headers added

Reported by: mbijon Owned by: nacin
Priority: normal Milestone: 3.5
Component: Appearance Version: 3.3
Severity: normal Keywords: has-patch commit
Cc: sabreuse@…, aaroncampbell, tomaugerdotcom@…, mercijavier@…, zamoose@…

Description

Support for flexible-height header images was added in #17242. In that ticket @aaroncampbell suggested we use Masonry to improve the layout of the Headers layout, http://core.trac.wordpress.org/ticket/17242#comment:63.

His patch applying Masonry to that page was then added in [20060], but @nacin found a bugs where the header images would overlap when Masonry was enabled, http://core.trac.wordpress.org/ticket/17242#comment:68. Masonry was then disabled in [20206] and removed entirely in [20340].

This ticket is to reintroduce Aaron's patch with Masonry, http://core.trac.wordpress.org/attachment/ticket/17242/17242.masonry.2.diff, and debug the overlapping images @nacin found. Or, create a different method for doing the same thing.

Attachments (6)

masonry.diff (2.0 KB) - added by zamoose 9 months ago.
jquery.masonry.min.js (5.4 KB) - added by zamoose 9 months ago.
jquery.masonry.js (14.5 KB) - added by zamoose 9 months ago.
masonry2.diff (2.0 KB) - added by zamoose 9 months ago.
20346.patch (7.6 KB) - added by SergeyBiryukov 9 months ago.
20346.2.patch (7.5 KB) - added by SergeyBiryukov 9 months ago.
Refreshed after [22030]

Download all attachments as: .zip

Change History (31)

comment:1 sabreuse15 months ago

  • Cc sabreuse@… added

comment:2 aaroncampbell15 months ago

  • Cc aaroncampbell added

comment:3 TomAuger14 months ago

  • Cc tomaugerdotcom@… added

comment:4 mercime14 months ago

  • Cc mercijavier@… added

comment:5 zamoose9 months ago

  • Cc zamoose@… added
  • Keywords has-patch added
  • Version set to trunk

I worked up a new patch that's consistent with the current version of trunk AND should account for images. Take a look.

zamoose9 months ago

comment:6 zamoose9 months ago

This quite obviously requires the Masonry JS files to be put into wp-includes/js. Wasn't sure how to account for that in the .diff.

zamoose9 months ago

zamoose9 months ago

comment:7 SergeyBiryukov9 months ago

  • Version changed from trunk to 3.3

Version number indicates when the enhancement was initially suggested.

comment:8 zamoose9 months ago

Whoops. Pass #2 -- let's move the Masonry enqueueing inside of the if().

zamoose9 months ago

comment:9 nacin9 months ago

This doesn't look any different from [20060] except that we're actually waiting until DOM ready this time. If that was our original problem, d'oh.

comment:10 zamoose9 months ago

That and the fact that Masonry freaks out if you don't wrap images in a call to imagesLoaded.

comment:11 follow-up: nacin9 months ago

  • Milestone changed from Awaiting Review to 3.5

I was going to say that we should move that code into custom-header.js and make masonry a dependency, but we don't have a custom-header.js. wp_enqueue_script('custom-header') is fairly useless, in that case. :-)

comment:12 nacin9 months ago

  • Component changed from Themes to Appearance

comment:13 in reply to: ↑ 11 SergeyBiryukov9 months ago

Replying to nacin:

I was going to say that we should move that code into custom-header.js and make masonry a dependency, but we don't have a custom-header.js.

We will in #20855 :)

comment:14 nacin9 months ago

Looks to me like the enqueueing in [20060] looks better than masonry2.diff. I don't remember what step 3 is, but masonry should be enqueued even when the theme doesn't support header-text, right?

comment:15 nacin9 months ago

  • Keywords needs-patch added; needs-testing has-patch removed

We should combine the approach in [20060] with the corrections in masonry2.diff.

SergeyBiryukov9 months ago

comment:16 SergeyBiryukov9 months ago

  • Keywords has-patch added; needs-patch removed

20346.patch introduces custom-header.js (also useful for #20855) and adds Masonry as a dependency. Left out the 'columnWidth: 230' part, seems better without it.

comment:17 follow-up: zamoose9 months ago

  • Version changed from 3.3 to trunk

Two notes:
1) Yes, it looks better without the columnWidth. I think I had that in as a legacy concern before I started messing with the imagesLoaded functionality.

2) I only enqueued it for custom headers since that's the only place it gets called and, well, efficiency?

comment:18 zamoose9 months ago

  • Version changed from trunk to 3.3

Crap. Not sure why it moved the version. Reverting.

comment:19 in reply to: ↑ 17 ; follow-up: nacin9 months ago

  • Keywords needs-refresh commit added

Replying to zamoose:

2) I only enqueued it for custom headers since that's the only place it gets called and, well, efficiency?

I was referring specifically to the fact that it was in a current_theme_supports( 'custom-header', 'header-text' ) block. I assumed the 'header-text' part was simply missed, but wanted to be sure of the intent.

I'm game for 20346.patch — does need an enqueue, though.

comment:20 in reply to: ↑ 19 SergeyBiryukov9 months ago

Replying to nacin:

I'm game for 20346.patch — does need an enqueue, though.

custom-header.js is already enqueued in js_includes():
http://core.trac.wordpress.org/browser/tags/3.4.2/wp-admin/custom-header.php#L173

comment:21 zamoose9 months ago

What needs done here? Do I need to issue a refresh?

SergeyBiryukov9 months ago

Refreshed after [22030]

comment:22 SergeyBiryukov9 months ago

  • Keywords needs-refresh removed

comment:23 zamoose9 months ago

Awesome.

comment:24 nacin8 months ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [22228]:

jQuery Masonry for uploaded custom headers. props zamoose. fixes #20346.

comment:25 koopersmith7 months ago

In 22504:

Custom Headers: Ensure the ready event fires before fetching the existing headers to apply jQuery.masonry. see #20346, #21820.

Note: See TracTickets for help on using tickets.