[wp-trac] [WordPress Trac] #26386: Add fixed full screen background option to custom backgrounds
WordPress Trac
noreply at wordpress.org
Tue Jan 28 00:55:53 UTC 2014
#26386: Add fixed full screen background option to custom backgrounds
-------------------------+------------------------------
Reporter: shelob9 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Appearance | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses: ui
-------------------------+------------------------------
Comment (by Shelob9):
I uploaded a patch 26386.2.diff that adds the filter I was talking about.
Here is example usage:
add_filter('custom_background_style', 'slug_full_screen_bg', 10, 2 );
function slug_full_screen_bg( $style, $background ) {
if ( $background != '' ) {
$style = "background-repeat: no-repeat; -webkit-background-size:
cover;-moz-background-size: cover;-o- background-size: cover
;background-size: cover;background-attachment:fixed;background-
position:center;";
$style .= " background-image: url('$background');";
}
return $style;
}
This example, to be used in a theme or plugin, creates a full-screen
background if an image is set in custom backgrounds, and just outputs the
background-color rule and value if none is set.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/26386#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list