get_template_directory_uri() . '/images/header.png',
// Set height and width, with a maximum value for the width.
'height' => 400,
'width' => 1200,
// Support flexible height and width.
'flex-height' => true,
'flex-width' => true,
// Random image rotation off by default.
'random-default' => false,
);
$args = apply_filters( 'custom-header', $args );
// Add support for custom header
add_theme_support( 'custom-header', $args );
}
endif; // foodland_custom_header
add_action( 'after_setup_theme', 'foodland_custom_header' );
if ( ! function_exists( 'foodland_site_branding' ) ) :
/**
* Get the logo and display
*
* @uses get_transient, foodland_get_theme_options, get_header_textcolor, get_bloginfo, set_transient, display_header_text
* @get logo from options
*
* @display logo
*
* @action
*
* @since Foodland 0.2
*/
function foodland_site_branding() {
$options = foodland_get_theme_options();
$site_title = get_bloginfo( 'name' );
$site_tagline = get_bloginfo( 'description' );
$logo_alt_text = $options['logo_alt_text'];
$site_logo = $options['logo'];
//Checking logo
if( 4.5 <= (float)get_bloginfo( 'version' ) ){
if( has_custom_logo() ){
$logo_image = get_custom_logo();
$foodland_site_logo = '
'. $logo_image . '
';
}else{
$foodland_site_logo = '';
}
}else{
if( !empty( $options['logo'] ) ){
$foodland_site_logo = '
';
}
else{
$foodland_site_logo = '';
}
}
// site title and description check
$site_title_enable = display_header_text(); // check to enable or disable site title
if ( ('' != $site_title || '' != $site_tagline ) && true == $site_title_enable ){
$foodland_header_text = '
';
}
else{
$foodland_header_text = '';
}
if ( '' != $foodland_site_logo ) {
$foodland_site_branding = '';
$foodland_site_branding .= $foodland_site_logo;
$foodland_site_branding .= $foodland_header_text;
$foodland_site_branding .= '
';
}
else {
$foodland_site_branding = '';
$foodland_site_branding .= $foodland_header_text;
$foodland_site_branding .= '
';
}
echo $foodland_site_branding ;
}
endif; // foodland_site_branding
add_action( 'foodland_header', 'foodland_site_branding', 50 );
if ( ! function_exists( 'foodland_featured_image' ) ) :
/**
* Template for Featured Header Image from theme options
*
* To override this in a child theme
* simply create your own foodland_featured_image(), and that function will be used instead.
*
* @since Foodland 0.2
*/
function foodland_featured_image() {
$options = foodland_get_theme_options();
$header_image = get_header_image();
//Support Random Header Image
if ( is_random_header_image() ) {
delete_transient( 'foodland_featured_image' );
}
if ( !$foodland_featured_image = get_transient( 'foodland_featured_image' ) ) {
echo '';
if ( $header_image != '' ) {
// Header Image Link and Target
if ( !empty( $options[ 'featured_header_image_url' ] ) ) {
$link = esc_url( $options[ 'featured_header_image_url' ] );
//Checking Link Target
if ( !empty( $options[ 'featured_header_image_base' ] ) ) {
$target = '_blank';
}
else {
$target = '_self';
}
}
else {
$link = '';
$target = '';
}
// Header Image Title/Alt
if ( !empty( $options[ 'featured_header_image_alt' ] ) ) {
$title = esc_attr( $options[ 'featured_header_image_alt' ] );
}
else {
$title = '';
}
// Header Image
$feat_image = '';
$foodland_featured_image = '';
}
set_transient( 'foodland_featured_image', $foodland_featured_image, 86940 );
}
echo $foodland_featured_image;
} // foodland_featured_image
endif;
if ( ! function_exists( 'foodland_featured_overall_image' ) ) :
/**
* Template for Featured Header Image from theme options
*
* To override this in a child theme
* simply create your own foodland_featured_pagepost_image(), and that function will be used instead.
*
* @since Foodland 0.2
*/
function foodland_featured_overall_image() {
global $post, $wp_query;
$options = foodland_get_theme_options();
$defaults = foodland_get_default_theme_options();
$enableheaderimage = $options['enable_featured_header_image'];
// Get Page ID outside Loop
$page_id = $wp_query->get_queried_object_id();
$page_for_posts = get_option('page_for_posts');
// Check Homepage
if ( $enableheaderimage == 'homepage' ) {
if ( is_front_page() || ( is_home() && $page_for_posts != $page_id ) ) {
foodland_featured_image();
}
}
else {
echo '';
}
} // foodland_featured_overall_image
endif;
add_action( 'foodland_after_header', 'foodland_featured_overall_image', 10 );