ID ) ) $post_id = $post->ID;
// Check if static frontpage (but not landing page)
if ( is_front_page() && ! is_home() && ! cryout_is_landingpage() ) {
$front_id = get_option( 'page_on_front' );
if ( !empty( $front_id ) ) $post_id = $front_id;
}
// Check if blog page
if ( cryout_on_blog() ) {
$blog_id = get_option( 'page_for_posts' );
if ( !empty( $blog_id ) ) $post_id = $blog_id;
}
// default to general header image
$header_image = FALSE;
if ( get_header_image() != '' ) { $header_image = get_header_image(); }
if ( ( is_singular() || cryout_on_blog() ) && has_post_thumbnail( $post_id ) && $theme_fheader &&
( $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'bravada-header' ) )
) :
if ( ( absint($image[1]) >= $theme_headerw ) && ( absint($image[2]) >= $theme_headerh ) ) {
// 'header' image is large enough
$header_image = $image[0];
} else {
// 'header' image too small, try 'full' image instead
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'full' );
if ( ( absint($image[1]) >= $theme_headerw ) && ( absint($image[2]) >= $theme_headerh ) ) {
// 'full' image is large enough
$header_image = $image[0];
}
// else: even 'full' image is too small, don't return an image
}
endif;
return apply_filters( 'bravada_header_image_url', $header_image );
} //bravada_header_image_url()
endif;
/**
* Header image handler
* Both as normal img and background image
*/
add_action ( 'cryout_headerimage_hook', 'bravada_header_image', 99 );
if ( ! function_exists( 'bravada_header_image' ) ) :
function bravada_header_image() {
if ( cryout_on_landingpage() && cryout_get_option('theme_lpslider') != 3) return; // if on landing page and static slider not set to header image, exit.
$header_image = bravada_header_image_url();
if ( is_front_page() && function_exists( 'the_custom_header_markup' ) && has_header_video() ) {
the_custom_header_markup();
} elseif ( ! empty( $header_image ) ) { ?>
' . get_the_author() . '';
} elseif ( is_post_type_archive() ) {
$title = post_type_archive_title( '', false );
} elseif ( is_tax() ) {
$title = single_term_title( '', false );
}
return $title;
} // bravada_archive_title()
add_filter( 'get_the_archive_title', 'bravada_archive_title' );
/**
* Adds title and description to header
* Used in header.php
*/
if ( ! function_exists( 'bravada_title_and_description' ) ) :
function bravada_title_and_description() {
$options = cryout_get_option( array( 'theme_logoupload', 'theme_siteheader' ) );
if ( in_array( $options['theme_siteheader'], array( 'logo', 'both' ) ) ) {
bravada_logo_helper( $options['theme_logoupload'] );
}
if ( in_array( $options['theme_siteheader'], array( 'title', 'both', 'logo', 'empty' ) ) ) {
$heading_tag = ( is_front_page() || ( is_home() ) ) ? 'h1' : 'div';
echo '';
echo '<' . $heading_tag . cryout_schema_microdata( 'site-title', 0 ) . ' id="site-title">';
echo '
' . esc_attr( get_bloginfo( 'name' ) ) . ' ';
echo '' . $heading_tag . '>';
echo '
' . esc_attr( get_bloginfo( 'description' ) ). '';
echo '
';
}
} // bravada_title_and_description()
endif;
add_action ( 'cryout_branding_hook', 'bravada_title_and_description' );
function bravada_logo_helper( $theme_logo ) {
$wp_logo = str_replace( 'class="custom-logo-link"', 'id="logo" class="custom-logo-link" title="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '"', get_custom_logo() );
if ( ! empty( $wp_logo ) ) {
echo '' . $wp_logo . '
';
} else {
echo '';
}
} // bravada_logo_helper()
// cryout_schema_publisher() located in cryout/prototypes.php
add_action( 'cryout_after_inner_hook', 'cryout_schema_publisher' );
add_action( 'cryout_singular_after_inner_hook', 'cryout_schema_publisher' );
// cryout_schema_main() located in cryout/prototypes.php
add_action( 'cryout_after_inner_hook', 'cryout_schema_main' );
add_action( 'cryout_singular_after_inner_hook', 'cryout_schema_main' );
// cryout_skiplink() located in cryout/prototypes.php
add_action( 'wp_body_open', 'cryout_skiplink', 2 );
/**
* Back to top button
*/
function bravada_back_top() {
echo '' . do_shortcode( cryout_get_option( 'theme_copyright' ) ). '
';
}
/*
* Sidebar handler
*/
if ( ! function_exists( 'bravada_get_sidebar' ) ) :
function bravada_get_sidebar() {
$layout = cryout_get_layout();
switch( $layout ) {
case '2cSl':
get_sidebar( 'left' );
break;
case '2cSr':
get_sidebar( 'right' );
break;
case '3cSl' : case '3cSr' : case '3cSs' :
get_sidebar( 'left' );
get_sidebar( 'right' );
break;
default:
break;
}
} // bravada_get_sidebar()
endif;
/*
* General layout class
*/
if ( ! function_exists( 'bravada_get_layout_class' ) ) :
function bravada_get_layout_class( $echo = true ) {
$layout = cryout_get_layout();
/* If not, return the general layout */
switch( $layout ) {
case '2cSl': $class = "two-columns-left"; break;
case '2cSr': $class = "two-columns-right"; break;
case '3cSl': $class = "three-columns-left"; break;
case '3cSr' : $class = "three-columns-right"; break;
case '3cSs' : $class = "three-columns-sided"; break;
case '1c':
default: $class = "one-column"; break;
}
// allow the generated layout class to be filtered
$output = esc_attr( apply_filters( 'bravada_general_layout_class', $class, $layout ) );
if ( $echo ) {
echo $output;
} else {
return $output;
}
} // bravada_get_layout_class()
endif;
/**
* Checks the browser agent string for mobile ids and adds "mobile" class to body if true
*/
add_filter( 'body_class', 'cryout_mobile_body_class');
/**
* Creates breadcrumbs with page sublevels and category sublevels.
* Hooked in master hook
*/
if ( ! function_exists( 'bravada_breadcrumbs' ) ) :
function bravada_breadcrumbs() {
cryout_breadcrumbs(
'', // $separator, usually