Make WordPress Core

Changes between Initial Version and Version 13 of Ticket #17242

04/27/2011 08:46:23 PM (7 years ago)


  • Ticket #17242

    • Property Cc ian@… mv@… lance@… added
    • Property Keywords 2nd-opinion added
    • Property Milestone changed from Awaiting Review to 3.2
    • Property Summary changed from Themes: Allow users to set the height for custom header image to Themes: Allow flexible sizes for custom header uploads
  • Ticket #17242 – Description

    initial v13  
    1 When uploading a custom header image allow users to specify the desired height of the image.
     1If a theme allows flexible header images the custom header feature should adjust the crop settings on upload to let the image through.
     3'''Theme Support'''
     5{{{add_theme_support( 'allow_flexible_header_height', 200 );}}} [[BR]] Where 200 is the maximum height allowed.
     7{{{add_theme_support( 'allow_flexible_header_width', 1000 );}}} [[BR]] Where 1000 is the maximum width allowed.
     9'''Custom Header Code'''
     11If 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.
     13If the option is on but dimension value is false or 0, let any size through (no crop at all).
    315'''Admin UI'''
    5 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.
    7 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.
    9 '''Theme Support'''
    11 To set a default value but allow overriding it from Appearance > Header use:
    12 {{{
    13         define( 'HEADER_IMAGE_HEIGHT', '200' );
    14         define( 'ALLOW_CUSTOM_HEADER_IMAGE_HEIGHT', true );
    15 }}}
    16 Default value for {{{ALLOW_CUSTOM_HEADER_IMAGE_HEIGHT}}} is false.
    18 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}}}.
    20 Note: If using this feature themes should avoid having a hard-coded height for the header image in the styles used for layout.
    22 '''Crop Without Height'''
    24 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.
    26 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.
    27 {{{
    28         define( 'HEADER_IMAGE_HEIGHT', 'custom' );
    29         define( 'ALLOW_CUSTOM_HEADER_IMAGE_HEIGHT', true );
    30 }}}
     17If a theme supports this, list the maximum dimensions in Appearance > Header. If no maximums are defined, leave it blank.