* * @link http://codex.wordpress.org/Custom_Headers * * @package Bootswatch */ /** * Add body class `has_header_image` if header image exists. */ add_action( 'body_class', function( $body_classes ) { if ( bootswatch_has( 'header_image' ) ) { return array_merge( $body_classes, [ 'has-header-image' ] ); } return $body_classes; } ); /** * Set up the WordPress core custom header feature. */ function bootswatch_custom_header_setup() { add_theme_support( 'custom-header', apply_filters( 'bootswatch_custom_header_args', array( 'default-image' => get_parent_theme_file_uri( '/header.jpg' ), 'header-text' => false, 'flex-height' => true, 'flex-width' => true, 'video' => true, 'wp-head-callback' => function() { if ( ! is_customize_preview() ) { return; } ?> array( 'url' => '%s/header.jpg', 'thumbnail_url' => '%s/header.jpg', 'description' => __( 'Default Header Image', 'bootswatch' ), ), ) ); } add_action( 'after_setup_theme', 'bootswatch_custom_header_setup' );