*
* @link https://developer.wordpress.org/themes/functionality/custom-headers/
*
* @package courtyard
*/
/**
* Set up the WordPress core custom header feature.
*
* @uses courtyard_header_style()
*/
function courtyard_custom_header_setup() {
add_theme_support( 'custom-header', apply_filters( 'courtyard_custom_header_args', array(
'width' => 2000,
'height' => 500,
'flex-height' => true,
'header-text' => true,
'video' => true,
'header-text' => false,
) ) );
}
add_action( 'after_setup_theme', 'courtyard_custom_header_setup' );
/*--------------------------------------------------------------------------------------------------*/
/**
* Filter the get_header_image_tag() for option of adding the link back to home page option
*/
function courtyard_header_image_markup( $html, $header, $attr ) {
$output = '';
$header_image = get_header_image();
if( ! empty( $header_image ) ) {
if ( get_theme_mod( 'courtyard_header_image_link_activate', 0 ) == 1 ) {
$output .= '';
}
$output .= '';
if ( get_theme_mod( 'courtyard_header_image_link_activate', 0 ) == 1 ) {
$output .= '';
}
}
return $output;
}
function courtyard_header_image_markup_filter() {
add_filter( 'get_header_image_tag', 'courtyard_header_image_markup', 10, 3 );
}
add_action( 'courtyard_header_image_markup_render','courtyard_header_image_markup_filter' );
/*--------------------------------------------------------------------------------------------------*/
// Video Header introduced in WordPress 4.7
if ( ! function_exists( 'courtyard_the_custom_header_markup' ) ) {
/**
* Displays the optional custom media headers.
*/
function courtyard_the_custom_header_markup() {
if ( function_exists('the_custom_header_markup') ) {
do_action( 'courtyard_header_image_markup_render' );
the_custom_header_markup();
} else {
$header_image = get_header_image();
if( ! empty( $header_image ) ) {
if ( get_theme_mod( 'courtyard_header_image_link_activate', 0 ) == 1 ) { ?>