* * @link https://developer.wordpress.org/themes/functionality/custom-headers/ * * @package bootspress */ /** * Set up the WordPress core custom header feature. * * @uses bootspress_header_style() */ function bootspress_custom_header_setup() { $args = array( 'default-image' => '', 'random-default' => false, 'width' => 1600, 'height' => 50, 'flex-height' => false, 'flex-width' => false, 'default-text-color' => '212529', 'header-text' => true, 'uploads' => true, 'wp-head-callback' => 'bootspress_header_style', 'admin-head-callback' => '', 'admin-preview-callback' => '', ); // Adds support for a custom header image. add_theme_support( 'custom-header', $args ); /* * Register a default header to be displayed by the custom header admin UI. * The %s is replaced with theme template directory URI. * To reference a image in a child theme (ie in the stylesheet directory), use %2$s instead of %s. */ register_default_headers( array( 'black' => array( 'url' => '%s/assets/images/headers/black.png', 'thumbnail_url' => '%s/assets/images/headers/black-thumbnail.png', 'description' => _x( 'Black', 'header image description', 'bootspress' ) ), 'gray' => array( 'url' => '%s/assets/images/headers/gray.png', 'thumbnail_url' => '%s/assets/images/headers/gray-thumbnail.png', 'description' => _x( 'Gray', 'header image description', 'bootspress' ) ), 'pink' => array( 'url' => '%s/assets/images/headers/pink.png', 'thumbnail_url' => '%s/assets/images/headers/pink-thumbnail.png', 'description' => _x( 'Pink', 'header image description', 'bootspress' ) ), ) ); } add_action( 'after_setup_theme', 'bootspress_custom_header_setup' ); if ( ! function_exists( 'bootspress_header_style' ) ) : /** * Styles the header image and text displayed on the blog. * * @see bootspress_custom_header_setup(). */ function bootspress_header_style() { $header_image = get_header_image(); $header_textcolor = get_header_textcolor(); // If header image is not set and header text color is set to default (no custom options are set), let's bail. // Header text color is then shown from style.css settings. if ( empty( $header_image ) && $header_textcolor == get_theme_support( 'custom-header', 'default-text-color' ) ) return; ?>