Themes: Allow flexible sizes for custom header uploads — at Version 13
|Reported by:||lancewillett||Owned by:|
|Cc:||ian@…, mv@…, lance@…, azizur, iamtakashi, aaroncampbell, sabreuse@…, fpb_gns, jeremy@…, chip@…, mike@…|
Description (last modified by lancewillett)
If a theme allows flexible header images the custom header feature should adjust the crop settings on upload to let the image through.
add_theme_support( 'allow_flexible_header_height', 200 );
Where 200 is the maximum height allowed.
add_theme_support( 'allow_flexible_header_width', 1000 );
Where 1000 is the maximum width allowed.
Custom Header Code
If the theme_support option exists and passes second argument (dimension as an integer), and the uploaded image dimension is higher, crop to size. If the uploaded image dimension is lower, save it with no crop.
If the option is on but dimension value is false or 0, let any size through (no crop at all).
If a theme supports this, list the maximum dimensions in Appearance > Header. If no maximums are defined, leave it blank.
Change History (15)
comment:5 follow-up: ↓ 7 aaroncampbell — 3 years ago
comment:11 in reply to: ↑ 9 lancewillett — 3 years ago
- Cc lance@… added
- Keywords 2nd-opinion added
- Summary changed from Themes: Allow users to set the height for custom header image to Themes: Allow any size custom header image