Random WordPress Function

Learn about a new WordPress function every day!


Function Signature:

header_image

Function Description:

Displays header image URL.

Function Examples:

⚠️ Examples below are generated with GPT-3 once every hour. Do not take them too seriously.
Consider them as some extra input in your learning process - reason about them. Will it work? What could fail?
// Example 1: Setting a default header image for the site
$header_image = get_header_image();
if ( empty( $header_image ) ) {
    echo 'Default Header Image';
}
// Example 2: Displaying a custom header image for a specific page
$header_image = get_header_image();
if ( is_page( 'about-us' ) ) {
    echo 'About Us Header Image';
} else {
    echo 'Default Header Image';
}
// Example 3: Adding a custom header image size
add_theme_support( 'custom-header', array(
    'width'         => 1920,
    'height'        => 400,
    'flex-height'   => true,
    'flex-width'    => true,
) );