Retrieves background image for custom background.
Source
function get_background_image() {
return get_theme_mod( 'background_image', get_theme_support( 'custom-background', 'default-image' ) );
}
Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
CARVIEW |
Retrieves background image for custom background.
function get_background_image() {
return get_theme_mod( 'background_image', get_theme_support( 'custom-background', 'default-image' ) );
}
Uses | Description |
---|---|
get_theme_support()wp-includes/theme.php | Gets the theme support arguments passed when registering that support. |
get_theme_mod()wp-includes/theme.php | Retrieves theme modification value for the active theme. |
Used by | Description |
---|---|
get_media_states()wp-admin/includes/template.php | Retrieves an array of media states from an attachment. |
Custom_Background::admin_page()wp-admin/includes/class-custom-background.php | Displays the custom background page. |
background_image()wp-includes/theme.php | Displays background image path. |
_custom_background_cb()wp-includes/theme.php | Default custom background callback. |
_delete_attachment_theme_mod()wp-includes/theme.php | Checks an attachment being deleted to see if it’s a header or background image. |
get_body_class()wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
Version | Description |
---|---|
3.0.0 | Introduced. |
You must log in before being able to contribute a note or feedback.
Use Theme Background Image as Fallback if No Featured Image Exists
This example could be used to detect whether the current Page/Post has a Featured Image set – if so, it will use the Featured Image as the page background, if not it will use the current active theme’s default background image. As is, this should be used in the of the page template, just after the call to wp_head() :