ID ) && $theme_fheader &&
( $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'esotera-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
//$header_image = false;
} */
}
endif;
return apply_filters( 'esotera_header_image_url', $header_image );
} //esotera_header_image_url()
endif;
/**
* Header image handler
* Both as normal img and background image
*/
add_action ( 'cryout_headerimage_hook', 'esotera_header_image', 99 );
if ( ! function_exists( 'esotera_header_image' ) ) :
function esotera_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 = esotera_header_image_url();
if ( is_front_page() && function_exists( 'the_custom_header_markup' ) && has_header_video() ) {
the_custom_header_markup();
} elseif ( ! empty( $header_image ) ) { ?>
';
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 '';
}
} // esotera_title_and_description()
endif;
add_action ( 'cryout_branding_hook', 'esotera_title_and_description' );
function esotera_logo_helper( $theme_logo ) {
if ( function_exists( 'the_custom_logo' ) ) {
// WP 4.5+
$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 {
// older WP
if ( ! empty( $theme_logo ) ) :
$img = wp_get_attachment_image_src( $theme_logo, 'full' );
echo '';
endif;
}
echo '';
} // esotera_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 esotera_back_top() {
echo '' . __('Back to Top', 'esotera') . ' ';
} // esotera_back_top()
add_action ( 'cryout_master_footerbottom_hook', 'esotera_back_top' );
/**
* Creates pagination for blog pages.
*/
if ( ! function_exists( 'esotera_pagination' ) ) :
function esotera_pagination( $pages = '', $range = 2, $prefix ='' ) {
$pagination = cryout_get_option( 'theme_pagination' );
if ( $pagination && function_exists( 'the_posts_pagination' ) ):
the_posts_pagination( array(
'prev_text' => '',
'next_text' => '',
'mid_size' => $range
) );
else:
//posts_nav_link();
esotera_content_nav( 'nav-old-below' );
endif;
} // esotera_pagination()
endif;
/**
* Prev/Next page links
*/
if ( ! function_exists( 'esotera_nextpage_links' ) ) :
function esotera_nextpage_links( $defaults ) {
$args = array(
'link_before' => '',
'link_after' => '',
);
$r = wp_parse_args( $args, $defaults );
return $r;
} // esotera_nextpage_links()
endif;
add_filter( 'wp_link_pages_args', 'esotera_nextpage_links' );
/**
* Footer Hook
*/
add_action( 'cryout_master_footer_hook', 'esotera_master_footer' );
function esotera_master_footer() {
$the_theme = wp_get_theme();
do_action( 'cryout_footer_hook' );
echo '';
}
add_action( 'cryout_master_footer_hook', 'esotera_copyright' );
function esotera_copyright() {
echo '' . do_shortcode( wp_kses_post( cryout_get_option( 'theme_copyright' ) ) ). '
';
}
/*
* Sidebar handler
*/
if ( ! function_exists( 'esotera_get_sidebar' ) ) :
function esotera_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;
}
} // esotera_get_sidebar()
endif;
/*
* General layout class
*/
if ( ! function_exists( 'esotera_get_layout_class' ) ) :
function esotera_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( 'esotera_general_layout_class', $class, $layout ) );
if ( $echo ) {
echo $output;
} else {
return $output;
}
} // esotera_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( 'esotera_breadcrumbs' ) ) :
function esotera_breadcrumbs() {
cryout_breadcrumbs(
'', // $separator
'', // $home
1, // $showCurrent
'', // $before
'', // $after
'', // $wrapper_post
esotera_get_layout_class(false), // $layout_class
__( 'Home', 'esotera' ), // $text_home
__( 'Archive for category "%s"', 'esotera' ), // $text_archive
__( 'Search results for "%s"', 'esotera' ), // $text_search
__( 'Posts tagged', 'esotera' ), // $text_tag
__( 'Articles posted by', 'esotera' ), // $text_author
__( 'Not Found', 'esotera' ), // $text_404
__( 'Post format', 'esotera' ), // $text_format
__( 'Page', 'esotera' ) // $text_page
);
} // esotera_breadcrumbs()
endif;
/**
* Adds searchboxes to the appropriate menu location
* Hooked in master hook
*/
if ( ! function_exists( 'cryout_search_menu' ) ) :
function cryout_search_menu( $items, $args ) {
$options = cryout_get_option( array( 'theme_searchboxmain', 'theme_searchboxfooter' ) );
if( $args->theme_location == 'primary' && $options['theme_searchboxmain'] ) {
$container_class = 'menu-main-search';
$items .= "";
}
if( $args->theme_location == 'footer' && $options['theme_searchboxfooter'] ) {
$container_class = 'menu-footer-search';
$items .= "" . get_search_form( false ) . "";
}
return $items;
} // cryout_search_mainmenu()
endif;
/**
* Adds burger icon to main menu for an extra menu
* Hooked in master hook
*/
if ( ! function_exists( 'cryout_burger_menu' ) ) :
function cryout_burger_menu( $items, $args = array() ) {
$button_html = "";
if (isset($args->theme_location)) {
// filtering wp_nav_menu_items
if( $args->theme_location == 'primary' ) {
$items .= $button_html;
}
} elseif (isset($args['menu_id']) && ('prime_nav' == $args['menu_id'])) {
// filtering wp_page_menu_args
$items = preg_replace( '/<\/ul>/is', $button_html . '', $items );
};
return $items;
} // cryout_burger_menu()
endif;
/**
* Normalizes tags widget font when needed
*/
if ( TRUE === cryout_get_option( 'theme_normalizetags' ) ) add_filter( 'wp_generate_tag_cloud', 'cryout_normalizetags' );
/**
* Adds preloader
*/
function esotera_preloader() {
$theme_preloader = cryout_get_option( 'theme_preloader' );
if ( ( $theme_preloader == 1) || ( $theme_preloader == 2 && (is_front_page() || is_home()) ) ): ?>
and tags
$moretag = false;
if (strpos( $text, '' )) $explodemore = explode('', $text);
if (strpos( $text, '' )) $explodemore = explode('', $text);
if (!empty($explodemore[1])) {
// tag was found
$text = $explodemore[0];
$moretag = true;
}
if ( '' != $text ) {
$text = strip_shortcodes( $text );
$text = str_replace(']]>', ']]>', $text);
// Filters the number of words in an excerpt. Default 35.
$excerpt_length = apply_filters( 'esotera_custom_excerpt_length', $length );
if ($excerpt_length == 0) return '';
// Filters the string in the "more" link displayed after a trimmed excerpt.
$excerpt_more = apply_filters( 'esotera_custom_excerpt_more', $more );
if (!$moretag) {
$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
}
}
return apply_filters( 'esotera_custom_excerpt', $text, $raw_excerpt );
} // esotera_custom_excerpt()
// ajax load more button alternative hook
add_action( 'template_redirect', 'cryout_ajax_init' );
/* FIN */