ID ) &&
($temperas['tempera_fheader'] == "Enable") &&
( $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'header' ) ) &&
$image[1] >= $temperas['tempera_totalSize']) {
$himgsrc = esc_url( $image[0] );
};
if ( isset( $himgsrc ) && ( $himgsrc != '' ) ) { echo '
'; } ?>
';
break;
case 'Clickable header image' :
echo '';
for ($i = 1; $i <= 9; $i+=2) {
$j = $i + 1;
if ( ${"tempera_social$j"} ) {
if (in_array(${"tempera_social$i"},$cryout_special_keys)) :
$cryout_current_social = esc_html( ${"tempera_social$j"} );
else :
$cryout_current_social = esc_url( ${"tempera_social$j"} );
endif; ?>
href=""
class="socialicons social-" title="">
" src="" />
';
} // tempera_set_social_icons()
endif;
/**
* Tempera back to top button
* Creates div for js
*/
if ( ! function_exists( 'tempera_back_top' ) ) :
function tempera_back_top() {
echo '
';
} // tempera_back_top()
endif;
if ( $temperas['tempera_backtop']=="Enable" ) add_action( 'cryout_main_hook', 'tempera_back_top' );
/**
* Creates breadcrumns with page sublevels and category sublevels.
*/
if ( ! function_exists( 'tempera_breadcrumbs' ) ) :
function tempera_breadcrumbs() {
$temperas = tempera_get_theme_options();
$showOnHome = 0; // 1 - show breadcrumbs on the homepage, 0 - don't show
$separator = '
'; // separator between crumbs
$home = '
' . __("Home", "tempera") . ''; // text for the 'Home' link
$showCurrent = 1; // 1 - show current post/page title in breadcrumbs, 0 - don't show
$before = '
'; // tag before the current crumb
$after = ''; // tag after the current crumb
global $post;
$homeLink = esc_url( home_url() );
if ( is_front_page() && ($temperas['tempera_frontpage']=="Enable") ) { return; }
// integrate layout class and microdata in wrapper_pre
$wrapper_pre = '
' . $home . $separator . ' ';
$wrapper_post = '
';
// woocommerce sections display their own breadcrumbs
if ( function_exists('woocommerce_breadcrumb') && is_woocommerce() ){
$args = array(
'delimiter' => $separator,
'wrap_before' => $wrapper_pre . ' ',
'wrap_after' => $wrapper_post,
'before' => '',
'after' => '',
'home' => false,
);
woocommerce_breadcrumb( $args );
return;
};
if ( is_home() && ($temperas['tempera_frontpage']!="Enable") ) {
if ($showOnHome == 1) echo '
';
} else {
echo $wrapper_pre;
if ( is_category() ) {
// category
$thisCat = get_category(get_query_var('cat'), false);
if ( $thisCat->parent != 0 ) echo get_category_parents( $thisCat->parent, TRUE, ' ' . $separator . ' ' );
echo $before . __('Archive by category','tempera').' "' . single_cat_title('', false) . '"' . $after;
} elseif ( is_search() ) {
// search
echo $before . __('Search results for','tempera').' "' . get_search_query() . '"' . $after;
} elseif ( is_day() ) {
// daily archive
echo '
' . get_the_time('Y') . ' ' . $separator . ' ';
echo '
' . get_the_time('F') . ' ' . $separator . ' ';
echo $before . get_the_time('d') . $after;
} elseif ( is_month() ) {
// monthly archive
echo '
' . get_the_time('Y') . ' ' . $separator . ' ';
echo $before . get_the_time('F') . $after;
} elseif ( is_year() ) {
// yearly archive
echo $before . get_the_time('Y') . $after;
} elseif ( is_single() && !is_attachment() ) {
// single post
if ( get_post_type() != 'post' ) {
$post_type = get_post_type_object(get_post_type());
$slug = $post_type->rewrite;
echo '
' . $post_type->labels->singular_name . '';
if ( $showCurrent == 1 ) echo ' ' . $separator . ' ' . $before . get_the_title() . $after;
} else {
$cat = get_the_category();
if ( !empty($cat[0]) ) { $cat = $cat[0]; } else { $cat = false; };
if ( $cat ) { $cats = get_category_parents($cat, TRUE, ' ' . $separator . ' '); } else { $cats=false; };
if ( $showCurrent == 0 && $cats ) $cats = preg_replace("#^(.+)\s$separator\s$#", "$1", $cats);
echo $cats;
if ( $showCurrent == 1 ) echo $before . get_the_title() . $after;
}
} elseif ( !is_single() && !is_page() && get_post_type() != 'post' && !is_404() ) {
// some other item
$post_type = get_post_type_object(get_post_type());
echo $before . $post_type->labels->singular_name . $after;
} elseif ( is_attachment() ) {
// attachment
$parent = get_post($post->post_parent);
$cat = get_the_category($parent->ID);
if ( !empty($cat[0]) ) { $cat = $cat[0]; } else { $cat=false; }
if ( $cat ) echo get_category_parents($cat, TRUE, ' ' . $separator . ' ');
echo '
' . $parent->post_title . '';
if ( $showCurrent == 1 ) echo ' ' . $separator . ' ' . $before . get_the_title() . $after;
} elseif ( is_page() && !$post->post_parent ) {
// parent page
if ($showCurrent == 1) echo $before . get_the_title() . $after;
} elseif ( is_page() && $post->post_parent ) {
// child page
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '
' . get_the_title($page->ID) . '';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
for ( $i = 0; $i < count($breadcrumbs); $i++ ) {
echo $breadcrumbs[$i];
if ($i != count($breadcrumbs)-1) echo ' ' . $separator . ' ';
}
if ( $showCurrent == 1 ) echo ' ' . $separator . ' ' . $before . get_the_title() . $after;
} elseif ( is_tag() ) {
// tag archive
echo $before . __('Posts tagged','tempera').' "' . single_tag_title('', false) . '"' . $after;
} elseif ( is_author() ) {
// author archive
global $author;
$userdata = get_userdata($author);
echo $before . __('Articles posted by','tempera'). ' ' . $userdata->display_name . $after;
} elseif ( is_404() ) {
// 404 archive
echo $before . __('Error 404','tempera') . $after;
}
elseif ( get_post_format() ) {
// post format
echo $before . '"' . ucwords( get_post_format() ) . '" ' . __( 'Post format', 'tempera' ) . $after;
}
if ( get_query_var('paged') ) {
if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' (';
echo __('Page','tempera') . ' ' . get_query_var('paged');
if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')';
}
echo $wrapper_post;
}
} // breadcrumbs
endif;
if ($temperas['tempera_breadcrumbs']=="Enable") add_action( 'cryout_before_content_hook', 'tempera_breadcrumbs' );
/* Add search box to menus */
if ( !empty($temperas['tempera_searchbar']['top']) ) add_filter('wp_nav_menu_items','cryout_search_topmenu', 10, 2);
if ( !empty($temperas['tempera_searchbar']['main']) ) add_filter('wp_nav_menu_items','cryout_search_primarymenu', 10, 2);
if ( !empty($temperas['tempera_searchbar']['footer']) ) add_filter('wp_nav_menu_items','cryout_search_footermenu', 10, 2);
function cryout_search_topmenu( $items, $args ) {
if( $args->theme_location == 'top') {
$items = $items . "";
}
return $items;
}
function cryout_search_primarymenu( $items, $args ) {
if( $args->theme_location == 'primary') {
$items = $items . "
" . get_search_form( FALSE ) . " ";
}
return $items;
}
function cryout_search_footermenu( $items, $args ) {
if( $args->theme_location == 'footer') {
$items = $items . "";
}
return $items;
}
if ( ! function_exists( 'tempera_pagination' ) ) :
/**
* Creates pagination for blog pages.
*/
function tempera_pagination( $pages = '', $range = 2, $prefix ='' ) {
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if ($pages == '')
{
global $wp_query;
$pages = $wp_query->max_num_pages;
if(!$pages)
{
$pages = 1;
}
}
if (1 != $pages)
{
echo "\n";
}
} // tempera_pagination()
endif;
function tempera_nextpage_links($defaults) {
$args = array(
'link_before' => '
',
'link_after' => '',
);
$r = wp_parse_args($args, $defaults);
return $r;
}
add_filter( 'wp_link_pages_args', 'tempera_nextpage_links' );
/**
* Site info
*/
function tempera_site_info() { ?>
&
' . wp_kses_post( $temperas['tempera_copyright'] ) . '
';
} // tempera_copyright()
if ( $temperas['tempera_copyright'] != '' ) add_action( 'cryout_footer_hook', 'tempera_copyright', 11 );
add_action( 'wp_ajax_nopriv_do_ajax', 'tempera_ajax_function' );
add_action( 'wp_ajax_do_ajax', 'tempera_ajax_function' );
if ( ! function_exists( 'tempera_ajax_function' ) ) :
function tempera_ajax_function(){
ob_clean();
// the first part is a SWTICHBOARD that fires specific functions
// according to the value of Query Var 'fn'
switch($_REQUEST['fn']){
case 'get_latest_posts':
$output = tempera_ajax_get_latest_posts( $_REQUEST['count'], $_REQUEST['categName'] );
break;
default:
$output = 'No function specified, check your jQuery.ajax() call';
break;
}
// at this point, $output contains some sort of valuable data!
// Now, convert $output to JSON and echo it to the browser
// That way, we can recapture it with jQuery and run our success function
$output = json_encode($output);
if ( is_array($output) ) { print_r($output); }
else { echo $output; }
die;
} // tempera_ajax_function()
endif;
if ( ! function_exists( 'tempera_ajax_get_latest_posts' ) ) :
function tempera_ajax_get_latest_posts( $count, $categName ){
$testVar='';
// The Query
$the_query = new WP_Query( 'category_name=' . $categName);
// The Loop
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) : $the_query->the_post();
$testVar .= the_title("