get_parent_theme_file_uri( '/assets/images/StockSnap_M6D1GS9PSL.jpg' ), 'width' => 2000, 'height' => 1200, 'flex-height' => true, 'video' => true, 'wp-head-callback' => 'inspiro_header_style', ) ) ); register_default_headers( array( 'default-image' => array( 'url' => '%s/assets/images/StockSnap_M6D1GS9PSL.jpg', 'thumbnail_url' => '%s/assets/images/StockSnap_M6D1GS9PSL.jpg', 'description' => __( 'Default Header Image', 'inspiro' ), ), 'forest-image' => array( 'url' => '%s/assets/images/StockSnap_89BQZ89TLH.jpg', 'thumbnail_url' => '%s/assets/images/StockSnap_89BQZ89TLH.jpg', 'description' => __( 'Forest', 'inspiro' ), ), ) ); } add_action( 'after_setup_theme', 'inspiro_custom_header_setup' ); if ( ! function_exists( 'inspiro_header_style' ) ) : /** * Styles the header image and text displayed on the blog. * * @see inspiro_custom_header_setup(). */ function inspiro_header_style() { $header_text_color = get_header_textcolor(); $header_button_text_color = inspiro_get_theme_mod( 'header_button_textcolor' ); $header_button_text_color_hover = inspiro_get_theme_mod( 'header_button_textcolor_hover' ); $header_button_bg_color_hover = inspiro_get_theme_mod( 'header_button_bgcolor_hover' ); ?> ' . __( 'Play background video', 'inspiro' ) . '' . inspiro_get_theme_svg( 'play' ); $settings['l10n']['pause'] = '' . __( 'Pause background video', 'inspiro' ) . '' . inspiro_get_theme_svg( 'pause' ); /** * Change the minimum screen size to use the video header. * * @since 1.3.1 */ $settings['minWidth'] = 100; $settings['minHeight'] = 100; /** * Adds support for Vimeo to the video in the custom header. * * @see https://github.com/bradyvercher/custom-header-vimeo */ if ( preg_match( '#^https?://(.+\.)?vimeo\.com/.*#', $settings['videoUrl'] ) ) { $settings['mimeType'] = 'video/x-vimeo'; } return $settings; } add_filter( 'header_video_settings', 'inspiro_video_controls' ); /** * Maybe enqueue custom header vimeo scripts */ function inspiro_maybe_enqueue_vimeo_handler() { if ( wp_script_is( 'wp-custom-header' ) ) { wp_enqueue_script( 'wp-custom-header-vimeo', inspiro_get_assets_uri( 'custom-header-vimeo', 'js' ), array( 'wp-custom-header' ), INSPIRO_THEME_VERSION, true ); } } add_action( 'wp_footer', 'inspiro_maybe_enqueue_vimeo_handler' ); /** * Filter extenal header video settting validity * * @param boolean $validity Validity. * @param string $value Video setting value. * @return boolean */ function inspiro_filter_external_header_video_setting_validity( $validity, $value ) { if ( preg_match( '#^https?://(.+\.)?vimeo\.com/.*#', $value ) ) { return true; } return $validity; } add_filter( 'customize_validate_external_header_video', 'inspiro_filter_external_header_video_setting_validity', 11, 2 );