%4$s';
$on = __( 'updated on ', 'blossom-recipe' );
}else{
$time_string = '';
}
}else{
$time_string = '';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
if( is_single() ) {
$posted_on = sprintf( '%1$s %2$s', esc_html( $on ), '' . $time_string . '' );
}else{
$posted_on = sprintf( '%1$s', '' . $time_string . '' );
}
echo '' . $posted_on . ''; // WPCS: XSS OK.
}
endif;
if ( ! function_exists( 'blossom_recipe_posted_by' ) ) :
/**
* Prints HTML with meta information for the current author.
*/
function blossom_recipe_posted_by() {
$byline = sprintf( '%s',
'' . esc_html( get_the_author() ) . ''
);
echo '' . $byline . '';
}
endif;
if( ! function_exists( 'blossom_recipe_comment_count' ) ) :
/**
* Comment Count
*/
function blossom_recipe_comment_count(){
if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
echo '';
}
}
endif;
if ( ! function_exists( 'blossom_recipe_category' ) ) :
/**
* Prints categories
*/
function blossom_recipe_category(){
// Hide category and tag text for pages.
if ( 'post' === get_post_type() ) {
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( esc_html__( ' ', 'blossom-recipe' ) );
if ( $categories_list ) {
echo '' . $categories_list . '';
}
}elseif( blossom_recipe_is_brm_activated() && 'blossom-recipe' === get_post_type() ){
$categories_list = get_the_term_list( '', 'recipe-category' );
if ( $categories_list ) {
echo '' . $categories_list . '';
}
}
}
endif;
if ( ! function_exists( 'blossom_recipe_tag' ) ) :
/**
* Prints tags
*/
function blossom_recipe_tag(){
// Hide category and tag text for pages.
if ( 'post' === get_post_type() ) {
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', esc_html_x( ' ', 'list item separator', 'blossom-recipe' ) );
if ( $tags_list ) {
/* translators: 1: list of tags. */
printf( '
' . esc_html__( '%1$sTags:%2$s %3$s', 'blossom-recipe' ) . '
', '', '', $tags_list );
}
}
}
endif;
if( ! function_exists( 'blossom_recipe_get_posts_list' ) ) :
/**
* Returns Latest, Related & Popular Posts
*/
function blossom_recipe_get_posts_list( $status ){
global $post;
$sidebar = blossom_recipe_sidebar( true );
$args = array(
'posts_status' => 'publish',
'ignore_sticky_posts' => true
);
switch( $status ){
case 'latest':
$args['post_type'] = 'post';
$args['posts_per_page'] = 4;
$title = __( 'Latest Posts', 'blossom-recipe' );
$class = 'latest';
$image_size = 'blossom-recipe-slider';
break;
case 'related':
$args['post_type'] = 'post';
$args['posts_per_page'] = ( $sidebar == 'full-width' ) ? 4 : 6;
$args['post__not_in'] = array( $post->ID );
$args['orderby'] = 'rand';
$title = get_theme_mod( 'related_post_title', __( 'You may also like...', 'blossom-recipe' ) );
$class = 'related';
$image_size = 'blossom-recipe-slider';
$cats = get_the_category( $post->ID );
if( $cats ){
$c = array();
foreach( $cats as $cat ){
$c[] = $cat->term_id;
}
$args['category__in'] = $c;
}
break;
}
$qry = new WP_Query( $args );
if( $qry->have_posts() ){ ?>
' . esc_html( $title ) . ''; ?>
have_posts() ){ $qry->the_post(); ?>
';
if( is_front_page() ){ ?>
';
endif;
?>
';
echo '' . esc_html__( 'Click here to add a menu', 'blossom-recipe' ) . '';
echo '';
}
}
endif;
if( ! function_exists( 'blossom_recipe_secondary_navigation' ) ) :
/**
* Secondary Navigation
*/
function blossom_recipe_secondary_navigation(){ ?>
';
echo '' . esc_html__( 'Click here to add a menu', 'blossom-recipe' ) . '';
echo '';
}
}
endif;
if( ! function_exists( 'blossom_recipe_theme_comment' ) ) :
/**
* Callback function for Comment List *
*
* @link https://codex.wordpress.org/Function_Reference/wp_list_comments
*/
function blossom_recipe_theme_comment( $comment, $args, $depth ){
if ( 'div' == $args['style'] ) {
$tag = 'div';
$add_below = 'comment';
} else {
$tag = 'li';
$add_below = 'div-comment';
}
?>
< id="comment-">
ID, '_blossom_recipe_sidebar_layout', true ) ){
$sidebar_layout = get_post_meta( $post->ID, '_blossom_recipe_sidebar_layout', true );
}else{
$sidebar_layout = 'default-sidebar';
}
if( is_page() ){
$template = array( 'templates/template-recipe-category.php', 'templates/template-recipe-cooking-method.php', 'templates/template-recipe-cuisine.php', 'templates/blossom-portfolio.php' );
if( is_page_template( $template ) ){
$return = $class ? 'full-width' : false;
}elseif( is_active_sidebar( 'sidebar' ) ){
if( $sidebar_layout == 'no-sidebar' || ( $sidebar_layout == 'default-sidebar' && $page_layout == 'no-sidebar' ) ){
$return = $class ? 'full-width' : false;
}elseif( $sidebar_layout == 'centered' || ( $sidebar_layout == 'default-sidebar' && $page_layout == 'centered' ) ){
$return = $class ? 'full-width centered' : false;
}elseif( ( $sidebar_layout == 'default-sidebar' && $page_layout == 'right-sidebar' ) || ( $sidebar_layout == 'right-sidebar' ) ){
$return = $class ? 'rightsidebar' : 'sidebar';
}elseif( ( $sidebar_layout == 'default-sidebar' && $page_layout == 'left-sidebar' ) || ( $sidebar_layout == 'left-sidebar' ) ){
$return = $class ? 'leftsidebar' : 'sidebar';
}
}else{
$return = $class ? 'full-width' : false;
}
}elseif( is_single() ){
if( is_active_sidebar( 'sidebar' ) ){
if( $sidebar_layout == 'no-sidebar' || ( $sidebar_layout == 'default-sidebar' && $post_layout == 'no-sidebar' ) ){
$return = $class ? 'full-width' : false;
}elseif( $sidebar_layout == 'centered' || ( $sidebar_layout == 'default-sidebar' && $post_layout == 'centered' ) ){
$return = $class ? 'full-width centered' : false;
}elseif( ( $sidebar_layout == 'default-sidebar' && $post_layout == 'right-sidebar' ) || ( $sidebar_layout == 'right-sidebar' ) ){
$return = $class ? 'rightsidebar' : 'sidebar';
}elseif( ( $sidebar_layout == 'default-sidebar' && $post_layout == 'left-sidebar' ) || ( $sidebar_layout == 'left-sidebar' ) ){
$return = $class ? 'leftsidebar' : 'sidebar';
}
}else{
$return = $class ? 'full-width' : false;
}
}
}elseif( blossom_recipe_is_woocommerce_activated() && ( is_shop() || is_product_category() || is_product_tag() || get_post_type() == 'product' ) ){
if( $layout == 'no-sidebar' ){
$return = $class ? 'full-width' : false;
}elseif( is_active_sidebar( 'shop-sidebar' ) ){
if( $class ){
if( $layout == 'right-sidebar' ) $return = 'rightsidebar'; //With Sidebar
if( $layout == 'left-sidebar' ) $return = 'leftsidebar';
}
}else{
$return = $class ? 'full-width' : false;
}
}elseif( is_404() ) {
$return = $class ? 'full-width' : false;
}else{
if( $layout == 'no-sidebar' ){
$return = $class ? 'full-width' : false;
}elseif( is_active_sidebar( 'sidebar' ) ){
if( $class ){
if( $layout == 'right-sidebar' ) $return = 'rightsidebar'; //With Sidebar
if( $layout == 'left-sidebar' ) $return = 'leftsidebar';
}else{
$return = 'sidebar';
}
}else{
$return = $class ? 'full-width' : false;
}
}
return $return;
}
endif;
if( ! function_exists( 'blossom_recipe_get_categories' ) ) :
/**
* Function to list post categories in customizer options
*/
function blossom_recipe_get_categories( $select = true, $taxonomy = 'category', $slug = false ){
/* Option list of all categories */
$categories = array();
$args = array(
'hide_empty' => false,
'taxonomy' => $taxonomy
);
$catlists = get_terms( $args );
if( $select ) $categories[''] = __( 'Choose Category', 'blossom-recipe' );
foreach( $catlists as $category ){
if( $slug ){
$categories[$category->slug] = $category->name;
}else{
$categories[$category->term_id] = $category->name;
}
}
return $categories;
}
endif;
if( ! function_exists( 'blossom_recipe_escape_text_tags' ) ) :
/**
* Remove new line tags from string
*
* @param $text
* @return string
*/
function blossom_recipe_escape_text_tags( $text ) {
return (string) str_replace( array( "\r", "\n" ), '', strip_tags( $text ) );
}
endif;
if( ! function_exists( 'blossom_recipe_get_image_sizes' ) ) :
/**
* Get information about available image sizes
*/
function blossom_recipe_get_image_sizes( $size = '' ) {
global $_wp_additional_image_sizes;
$sizes = array();
$get_intermediate_image_sizes = get_intermediate_image_sizes();
// Create the full array with sizes and crop info
foreach( $get_intermediate_image_sizes as $_size ) {
if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {
$sizes[ $_size ]['width'] = get_option( $_size . '_size_w' );
$sizes[ $_size ]['height'] = get_option( $_size . '_size_h' );
$sizes[ $_size ]['crop'] = (bool) get_option( $_size . '_crop' );
} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
$sizes[ $_size ] = array(
'width' => $_wp_additional_image_sizes[ $_size ]['width'],
'height' => $_wp_additional_image_sizes[ $_size ]['height'],
'crop' => $_wp_additional_image_sizes[ $_size ]['crop']
);
}
}
// Get only 1 size if found
if ( $size ) {
if( isset( $sizes[ $size ] ) ) {
return $sizes[ $size ];
} else {
return false;
}
}
return $sizes;
}
endif;
if ( ! function_exists( 'blossom_recipe_get_fallback_svg' ) ) :
/**
* Get Fallback SVG
*/
function blossom_recipe_get_fallback_svg( $post_thumbnail ) {
if( ! $post_thumbnail ){
return;
}
$image_size = blossom_recipe_get_image_sizes( $post_thumbnail );
if( $image_size ){ ?>
urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
);
if ( $fonts ) {
$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
}
return esc_url_raw( $fonts_url );
}
endif;