????
| Current Path : /home2/morganrand/www/wp-content/themes/wanderfuls-2/framework/classes/ |
| Current File : /home2/morganrand/www/wp-content/themes/wanderfuls-2/framework/classes/custom-header.php |
<?php
/**
* Adds support for the Custom Header image and adds it to the header
*
* @package Wanderfuls WordPress Theme
* @subpackage Framework
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Start Class
if ( ! class_exists( 'TB_Custom_Header' ) ) {
class TB_Custom_Header {
/**
* Main constructor
*
* @since 1.6.3
*/
public function __construct() {
add_filter( 'after_setup_theme', array( $this, 'add_support' ) );
add_filter( 'tb_head_css', array( $this, 'custom_header_css' ), 99 );
}
/**
* Retrieves cached CSS or generates the responsive CSS
*
* @since 1.6.0
*/
public static function add_support() {
add_theme_support( 'custom-header', apply_filters( 'tb_custom_header_args', array(
'default-image' => '',
'width' => 0,
'height' => 0,
'flex-width' => true,
'flex-height' => true,
'admin-head-callback' => 'tb_admin_header_style',
'admin-preview-callback' => 'tb_admin_header_image',
) ) );
}
/**
* Displays header image as a background for the header
*
* @since 1.6.0
*/
public static function custom_header_css( $output ) {
if ( $header_image = get_header_image() ) {
$output .= '#site-header,.is-sticky #site-header{background-image:url('. $header_image .');background-size: cover;}';
}
return $output;
}
}
}
new TB_Custom_Header();