background_image()
Outputs the URL of the background image set in the theme settings (in the customizer).
This is a wrapper for the function get_background_image(). For detailed description see there.
Uses: get_background_image()
1 time — 0.002051 sec (very slow) | 50000 times — 1.90 sec (fast) | PHP 7.2.5, WP 5.0
No Hooks.
Returns
null. Nothing (null). Outputs the URL.
Usage
<?php background_image(); ?>
Examples
#1 Display the URL in the css styles
<style>
body.custom-background {
background-image: url( '<?php background_image(); ?>' );
}
</style>
For more examples, see get_background_image().
Changelog
| Since 3.0.0 | Introduced. |
background_image() background image code WP 7.0
function background_image() {
echo get_background_image();
}