* * @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. * * @uses bootswatch_header_style() * @uses bootswatch_admin_header_style() * @uses bootswatch_admin_header_image() */ function bootswatch_custom_header_setup() { add_theme_support( 'custom-header', apply_filters( 'bootswatch_custom_header_args', array( 'default-image' => get_parent_theme_file_uri( '/img/header.jpg' ), 'header-text' => false, 'flex-height' => true, 'flex-width' => true, 'video' => true, ) ) ); register_default_headers( array( 'default-image' => array( 'url' => '%s/img/header.jpg', 'thumbnail_url' => '%s/img/header.jpg', 'description' => __( 'Default Header Image', 'bootswatch' ), ), ) ); } add_action( 'after_setup_theme', 'bootswatch_custom_header_setup' ); if ( ! function_exists( 'bootswatch_header_style' ) ) : /** * Styles the header image and text displayed on the blog * * @see bootswatch_custom_header_setup(). */ function bootswatch_header_style() { $header_text_color = get_header_textcolor(); // If no custom options for text are set, let's bail // get_header_textcolor() options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value. if ( HEADER_TEXTCOLOR === $header_text_color ) { return; } // If we get this far, we have custom styles. Let's do this. ?> Header admin panel. * * @see bootswatch_custom_header_setup(). */ function bootswatch_admin_header_style() { ?> Header admin panel. * * @see bootswatch_custom_header_setup(). */ function bootswatch_admin_header_image() { ?>