* * @link https://developer.wordpress.org/themes/functionality/custom-headers/ * * @package Corporacy */ /** * Sets up the WordPress core custom header and custom background features. * * @since 1.0.0 * * @see corporacy_header_style() */ function corporacy_custom_header_and_bg() { add_theme_support( 'custom-background', apply_filters( 'corporacy_custom_bg_args', array( 'default-color' => '#ffffff', ) ) ); /** * Filter the arguments used when adding 'custom-header' support in Corporacy. * * @since 1.0.0 * * @param array $args { * An array of custom-header support arguments. * * @type string $default-text-color Default color of the header text. * @type int $width Width in pixels of the custom header image. Default 1200. * @type int $height Height in pixels of the custom header image. Default 280. * @type bool $flex-height Whether to allow flexible-height header images. Default true. * @type callable $wp-head-callback Callback function used to style the header image and text * displayed on the blog. * } */ add_theme_support( 'custom-header', apply_filters( 'corporacy_custom_header_args', array( 'default-image' => get_parent_theme_file_uri( '/assets/images/header-image.png' ), 'default-text-color' => '#000000', 'width' => 1920, 'height' => 1080, 'flex-height' => true, 'flex-height' => true, 'wp-head-callback' => 'corporacy_header_style', 'video' => true, ) ) ); register_default_headers( array( 'default-image' => array( 'url' => '%s/assets/images/header-image.png', 'thumbnail_url' => '%s/assets/images/header-image-275x155.png', 'description' => esc_html__( 'Default Header Image', 'corporacy' ), ) ) ); } add_action( 'after_setup_theme', 'corporacy_custom_header_and_bg' ); if ( ! function_exists( 'corporacy_header_style' ) ) : /** * Styles the header image and text displayed on the blog. * * @see corporacy_custom_header_setup(). */ function corporacy_header_style() { $header_image = corporacy_featured_overall_image(); if ( 'disable' !== $header_image ) : /** * Image Position CSS */ $image_position_mobile = get_theme_mod( 'corporacy_header_media_image_position_mobile', 'center center' ); $image_position_desktop = get_theme_mod( 'corporacy_header_media_image_position_desktop' , 'center center' ); ?>

'; if ( is_singular() ) { corporacy_header_title( $before, '

' ); } else { corporacy_header_title( $before, '
' ); } ?> ', '' ); ?>

' . get_search_query() . '' ) . $after; } else { the_archive_title( $before, $after ); } } endif; if ( ! function_exists( 'corporacy_header_description' ) ) : /** * Display header media description */ function corporacy_header_description( $before = '', $after = '' ) { if ( is_front_page() && get_theme_mod( 'corporacy_header_media_text' ) ) { echo $before . '

' . wp_kses_post( get_theme_mod( 'corporacy_header_media_text' ) ) . '

' . $after; } elseif ( is_singular() && ! is_page() ) { echo $before . '
'; corporacy_posted_on(); echo '
' . $after; } elseif ( is_404() ) { echo $before . '

' . esc_html__( 'Oops! That page can’t be found', 'corporacy' ) . '

' . $after; } else { the_archive_description( $before, $after ); } } endif; if ( ! function_exists( 'corporacy_video_controls' ) ) : /** * Customize video play/pause button in the custom header. */ function corporacy_video_controls( $settings ) { $settings['l10n']['play'] = '' . esc_html__('Play background video', 'corporacy') . '' . corporacy_get_svg(array('icon' => 'play')); $settings['l10n']['pause'] = '' . esc_html__('Pause background video', 'corporacy') . '' . corporacy_get_svg(array('icon' => 'pause')); return $settings; } add_filter('header_video_settings', 'corporacy_video_controls'); endif;