<?php
/**
 * Sample implementation of the Custom Header feature
 *
 * You can add an optional custom header image to header.php like so ...
 *
	<?php the_header_image_tag(); ?>
 *
 * @link https://developer.wordpress.org/themes/functionality/custom-headers/
 *
 * @package Online_News
 */

/**
 * Set up the WordPress core custom header feature.
 *
 * @uses online_news_header_style()
 */
function online_news_custom_header_setup() {
	add_theme_support( 'custom-header', apply_filters( 'online_news_custom_header_args', array(
		'default-image'          => '',
		'default-text-color'     => '000000',
		'width'                  => 1000,
		'height'                 => 250,
		'flex-height'            => true,
		'wp-head-callback'       => 'online_news_header_style',
	) ) );
}
add_action( 'after_setup_theme', 'online_news_custom_header_setup' );
 
function online_news_header_style() {
	wp_enqueue_style( 'online-news-style', get_stylesheet_uri() );
	$header_text_color = get_header_textcolor();
	if ( ! display_header_text() ) {
		$custom_css = '.site-title, .site-branding p{
			position: "absolute";
			clip: "rect(1px, 1px, 1px, 1px)"; 
		}';
	} else{

		$custom_css = '.site-title a, .site-branding p {
			color: #' . esc_attr($header_text_color) . ';			
		}';
	}
	wp_add_inline_style( 'online-news-style', $custom_css );
}
add_action( 'wp_enqueue_scripts', 'online_news_header_style' ); 

