[wp-trac] [WordPress Trac] #17242: Themes: Allow users to set the height for custom header image
WordPress Trac
wp-trac at lists.automattic.com
Tue Apr 26 05:09:47 UTC 2011
#17242: Themes: Allow users to set the height for custom header image
--------------------------+-----------------------------
Reporter: lancewillett | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version:
Severity: normal | Keywords: needs-patch
--------------------------+-----------------------------
When uploading a custom header image allow users to specify the desired
height of the image.
'''Admin UI'''
Appearance > Header could show the height as a text input field with the
default height as the value. After you upload an image the cropper tool
would use the value you entered for the height.
The value would fall back to height value defined in
{{{HEADER_IMAGE_HEIGHT}}} in the theme functions.php file if not changed
by the user. See attached screenshot for example of the editable height.
'''Theme Support'''
To set a default value but allow overriding it from Appearance > Header
use:
{{{
define( 'HEADER_IMAGE_HEIGHT', '200' );
define( 'ALLOW_CUSTOM_HEADER_IMAGE_HEIGHT', true );
}}}
Default value for {{{ALLOW_CUSTOM_HEADER_IMAGE_HEIGHT}}} is false.
To use the header image in template files use {{{HEADER_IMAGE_HEIGHT}}}
value in HTML attributes or use dynamic CSS to use the header image as a
background image and set the height of its container to
{{{HEADER_IMAGE_HEIGHT}}}.
Note: If using this feature themes should avoid having a hard-coded height
for the header image in the styles used for layout.
'''Crop Without Height'''
A tangential idea: Allow a header image to be uploaded constrained by
width but not height in the crop tool. After upload use the image height
as the custom height value for the theme.
In this case, in functions.php theme authors could set the height
definition to "custom" default value and when calling
{{{HEADER_IMAGE_HEIGHT}}} in templates it'd return the height of the
uploaded image.
{{{
define( 'HEADER_IMAGE_HEIGHT', 'custom' );
define( 'ALLOW_CUSTOM_HEADER_IMAGE_HEIGHT', true );
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/17242>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list