[wp-trac] [WordPress Trac] #39916: Add position, preset and size controls to custom-header
WordPress Trac
noreply at wordpress.org
Mon Feb 20 08:11:53 UTC 2017
#39916: Add position, preset and size controls to custom-header
-----------------------------+------------------------------
Reporter: dingo_bastard | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version: 4.7.2
Severity: normal | Resolution:
Keywords: | Focuses:
-----------------------------+------------------------------
Comment (by dingo_bastard):
The positioning of `<img>` using this would be a bit complicated I agree.
But I was working on a theme, and added the `custom-header` image as a
background image in a breadcrumbs
{{{#!php
<div id="element" style="background-image: url(image-url.jpg); background-
size:cover; background-position: center center;">div content goes
here</div>
}}}
and now I see that I can add it as a dynamic inline style
{{{#!css
#element{
background-image: url(image-url.jpg);
background-size: cover;
background-position: center center;
}
}}}
But the idea is to control the `custom-header` in the same way that we
control the `custom-background`. We could add a `'default-element'` key to
the arguments array to which this css would be appended to. If this is
empty then the `<img>` element that outputs the header image can be used
as described [[https://developer.wordpress.org/themes/functionality
/custom-headers/|here]].
{{{#!php
$args = array(
'default-image' => get_template_directory_uri() . 'img/default-
image.jpg',
'default-text-color' => '000',
'width' => 1000,
'height' => 250,
'flex-width' => true,
'flex-height' => true,
'default-element' => '#element',
);
add_theme_support( 'custom-header', $args );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39916#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list