'000',
// Header image default
'default-image' => get_template_directory_uri() . '/images/headers/nature.jpg',
// Set height and width, with a maximum value for the width.
'height' => 400,
'width' => 1600,
// Support flexible height and width.
'flex-height' => true,
'flex-width' => true,
// Random image rotation off by default.
'random-default' => false,
// Callbacks for styling the header and the admin preview.
'wp-head-callback' => 'catchflames_header_style',
'admin-head-callback' => 'catchflames_admin_header_style',
'admin-preview-callback' => 'catchflames_admin_header_image',
);
$args = apply_filters( 'custom-header', $args );
// Add support for custom header
add_theme_support( 'custom-header', $args );
}
add_action( 'after_setup_theme', 'catchflames_custom_header_setup' );
if ( ! function_exists( 'catchflames_header_style' ) ) :
/**
* Styles the header image and text displayed on the blog
*
* @since Catch Flames 1.0
*/
function catchflames_header_style() {
global $catchflames_options_settings, $catchflames_options_defaults;
$options = $catchflames_options_settings;
$defaults = $catchflames_options_defaults;
$text_color = get_header_textcolor();
// If no custom options for text are set, let's bail.
if ( $text_color == HEADER_TEXTCOLOR )
return;
// If we get this far, we have custom styles. Let's do this.
?>
Header admin panel.
*
* @since Catch Flames 1.0
*/
function catchflames_admin_header_style() {
global $catchflames_options_settings, $catchflames_options_defaults;
$options = $catchflames_options_settings;
$defaults = $catchflames_options_defaults;
?>
Header admin panel.
*
* @since Catch Flames 1.0
*/
function catchflames_admin_header_image() { ?>
';
$catchflames_logo = '';
if ( 'blank' == $text_color ) {
$classses = 'title-disable';
}
elseif ( 'blank' != $text_color ) {
$classses = 'title-right';
}
elseif ( 'blank' != $text_color ) {
$classses = 'title-left';
}
else {
$classses = 'clear';
}
$catchflames_logo .= '';
set_transient( 'catchflames_logo', $catchflames_logo, 86940 );
}
echo $catchflames_logo;
} // catchflames_logo
endif;
if ( ! function_exists( 'catchflames_site_details' ) ) :
/**
* Template for Site Details
*
* To override this in a child theme
* simply create your own catchflames_header_details(), and that function will be used instead.
*
* @since Catch Flames 1.0
*/
function catchflames_site_details() {
$classses = 'clear';
?>
';
echo catchflames_logo();
echo catchflames_site_details();
echo '';
}
endif; //catchflames_headerdetails
add_action( 'catchflames_headercontent', 'catchflames_headerdetails', 30 );
/**
* Header Right Sidebar
*
* @Hooked in catchflames_headercontent
* @since Catch Flames 1.0
*/
function catchflames_header_rightsidebar() {
get_sidebar( 'headerright' );
}
add_action( 'catchflames_headercontent', 'catchflames_header_rightsidebar', 40 );
if ( ! function_exists( 'catchflames_header_search' ) ) :
/**
* Header Search Box
*
* @since Catch Flames 1.0
*/
function catchflames_header_search() { ?>
';
$linkclose = '';
else:
$link = '';
$base = '';
$linkopen = '';
$linkclose = '';
endif;
echo '';
}
} // catchflames_featured_image
endif;
if ( ! function_exists( 'catchflames_featured_page_post_image' ) ) :
/**
* Template for Header Featured Image from Post and Page
*
* To override this in a child theme
* simply create your own catchflames_featured_page_post_image(), and that function will be used instead.
*
* @since Catch Flames 1.0
*/
function catchflames_featured_page_post_image() {
global $post, $wp_query, $catchflames_options_settings, $catchflames_options_defaults;
$options = $catchflames_options_settings;
$defaults = $catchflames_options_defaults;
$enableheaderimage = $options[ 'enable_featured_header_image' ];
// Front page displays in Reading Settings
$page_on_front = get_option('page_on_front') ;
$page_for_posts = get_option('page_for_posts');
// Get Page ID outside Loop
$page_id = $wp_query->get_queried_object_id();
if ( $enableheaderimage == 'disable' ) {
echo '';
}
elseif ( is_home() || is_archive() ) {
if ( $enableheaderimage == 'postpage' ) {
catchflames_featured_image();
}
else {
echo '';
}
}
elseif ( has_post_thumbnail() ) {
echo '';
}
else {
catchflames_featured_image();
}
} // catchflames_featured_page_post_image
endif;
if ( ! function_exists( 'catchflames_featured_overall_image' ) ) :
/**
* Template for Header Featured Options
*
* To override this in a child theme
* simply create your own catchflames_featured_overall_image(), and that function will be used instead.
*
* @since Catch Flames 1.0
*/
function catchflames_featured_overall_image() {
global $post, $wp_query, $catchflames_options_settings, $catchflames_options_defaults;
$options = $catchflames_options_settings;
$defaults = $catchflames_options_defaults;
$enableheaderimage = $options[ 'enable_featured_header_image' ];
// Front page displays in Reading Settings
$page_on_front = get_option('page_on_front') ;
$page_for_posts = get_option('page_for_posts');
// Get Page ID outside Loop
$page_id = $wp_query->get_queried_object_id();
if ( $enableheaderimage == 'allpage' || ( $enableheaderimage == 'homepage' && ( is_front_page() || ( is_home() && $page_for_posts != $page_id ) ) ) ) {
catchflames_featured_image();
}
elseif ( $enableheaderimage == 'excludehome' && !(is_home() ) ) {
catchflames_featured_image();
}
elseif ( $enableheaderimage == 'postpage' || $enableheaderimage == 'pagespostes' ) {
catchflames_featured_page_post_image();
}
else {
echo '';
}
} // catchflames_featured_overall_image
endif;
if ( ! function_exists( 'catchflames_featured_header' ) ) :
/**
* Template for Displaying Featured Header Image with position selected in Theme Options Panel
*
* To override this in a child theme
* simply create your own catchflames_featured_header(), and that function will be used instead.
*
* @since Catch Flames 1.0
*/
function catchflames_featured_header() {
add_action( 'catchflames_after_header', 'catchflames_featured_overall_image', 10 );
} // catchflames_featured_image_display
endif;
add_action( 'catchflames_before', 'catchflames_featured_header', 10 );