4) $count = 4; if( $echo ) echo esc_attr($count); else return $count; } function os_item_data(){ if(function_exists('echo_tptn_post_count')){ $total_views = do_shortcode('[tptn_views daily="0"]'); }else{ $total_views = 0; } $likes = get_post_meta(get_the_ID(), '_zilla_likes', true); return ' data-post-id="'.get_the_ID().'" data-total-likes="'.esc_attr($likes).'" data-total-views="'.esc_attr($total_views).'"'; } function os_list_categories_for_filtering($post_id){ $categories_string = ''; $categories = get_the_category( $post_id ); if(is_array($categories)){ foreach($categories as $category){ $categories_string.= 'filter-cat-'.$category->term_id.' '; } } $format = get_post_format() ? : 'standard'; $categories_string.= ' format-'.$format.' '; return $categories_string; } function osetin_show_filter_bar(){ if(!(osetin_get_field('hide_sorting') && osetin_get_field('hide_category_filtering') && osetin_get_field('hide_format_filtering')) && osetin_get_field('show_filter_panel', 'option') && !osetin_get_field('hide_filter_toolbar', false, false)){ echo '
'; $filter_bg_type = os_get_less_var('subBarBackgroundType', 'light'); $filter_bg_color = osetin_get_field('filter_bar_background_color_option', 'option', false); $filter_bg_image_id = osetin_get_field('filter_bar_background_image_option', 'option', false); $filter_bg_image_url = false; if($filter_bg_image_id){ $filter_bg_image_arr = wp_get_attachment_image_src($filter_bg_image_id, "osetin-for-background"); if($filter_bg_image_arr && isset($filter_bg_image_arr[0])) $filter_bg_image_url = $filter_bg_image_arr[0]; } $bg_color_css = $filter_bg_color ? 'background-color: '.$filter_bg_color.';' : ''; $bg_image_css = $filter_bg_image_url ? 'background-image:url('.$filter_bg_image_url.'); background-repeat: repeat;' : ''; echo '
'; if(osetin_get_field('hide_sorting') != true){ echo '
'; echo '
'.esc_html__('Order By', 'pluto').'
'; echo '
'; echo '
'; } echo '
'; $categories_to_show_as_buttons = osetin_get_field('categories_to_show_as_buttons', false, false); $formats_to_show_in_filter = osetin_get_field('formats_to_show_in_filter', false, false); if($formats_to_show_in_filter || $categories_to_show_as_buttons){ echo '
'.esc_html__('Filter', 'pluto').'
'; } if(osetin_get_field('hide_category_filtering') != true && $categories_to_show_as_buttons){ //echo '
'.esc_html__('Category', 'pluto').'
'; echo '
'; $index = 1; foreach($categories_to_show_as_buttons as $category_id){ if($index == 4) break; echo ''; $index++; } echo '
'; } if(osetin_get_field('hide_format_filtering') != true && $formats_to_show_in_filter){ echo '
'.esc_html__('Format', 'pluto').'
'; echo '
'; if(in_array( 'standard', $formats_to_show_in_filter )) echo '
'.esc_html__('standard', 'pluto').'
'; if(in_array( 'image', $formats_to_show_in_filter )) echo '
'.esc_html__('image', 'pluto').'
'; if(in_array( 'gallery', $formats_to_show_in_filter )) echo '
'.esc_html__('gallery', 'pluto').'
'; if(in_array( 'video', $formats_to_show_in_filter )) echo '
'.esc_html__('video', 'pluto').'
'; if(in_array( 'quote', $formats_to_show_in_filter )) echo '
'.esc_html__('quote', 'pluto').'
'; if(in_array( 'audio', $formats_to_show_in_filter )) echo '
'.esc_html__('audio', 'pluto').'
'; if(in_array( 'link', $formats_to_show_in_filter )) echo '
'.esc_html__('link', 'pluto').'
'; echo '
'; } if(osetin_get_field('hide_clear_filters_button') != true){ echo '
'; echo ''; echo '
'; } echo '
'; echo '
'; echo '
'; } } // Excerpt "more" text settigns function new_excerpt_more() { if(get_post_format(get_the_ID()) == 'link'){ return '...'; }else{ return '...'; } } add_filter( 'excerpt_more', 'new_excerpt_more' ); function os_excerpt($limit = 16, $more = TRUE) { if(!$limit){ $limit = 16; } if($more){ return wp_trim_words(get_the_excerpt(), $limit, new_excerpt_more()); }else{ return wp_trim_words(get_the_excerpt(), $limit, ""); } } function os_quote_excerpt($limit = 16){ return wp_trim_words(get_the_excerpt(), $limit, '...' . __('Read More', 'pluto') . ''); } function os_get_less_var($key, $default){ global $my_less; return $my_less->get_var($key, $default); } function os_footer(){ ?>
query['paged']) ) ? $os_query->query['paged'] : 1; $next_page = ($current_page < $os_query->max_num_pages) ? $current_page + 1 : false; if($next_page){ return http_build_query(wp_parse_args( array('paged' => $next_page), $os_query->query)); }else{ return false; } } // Loads get_template_part() into variable function os_load_template_part($template_name, $part_name=null) { ob_start(); get_template_part($template_name, $part_name); $var = ob_get_contents(); ob_end_clean(); return $var; } function get_current_menu_position() { if(isset($_SESSION['menu_position'])){ $menu_position = $_SESSION['menu_position']; }else{ $menu_position = get_field('menu_position', 'option'); } return $menu_position; } function get_current_menu_style() { if(isset($_SESSION['menu_style'])){ $menu_style = $_SESSION['menu_style']; }else{ $menu_style = get_field('menu_style', 'option'); } return $menu_style; } function os_get_current_color_scheme() { if(isset($_SESSION['color_scheme'])){ $color_scheme = $_SESSION['color_scheme']; }else{ $color_scheme = get_field('color_scheme', 'option'); } return $color_scheme; } function os_get_current_navigation_type() { if(isset($_SESSION['navigation_type'])){ $navigation_type = $_SESSION['navigation_type']; }else{ $navigation_type = get_field('index_navigation_type', 'option'); } return $navigation_type; } function os_lightbox_posts_enabled_class(){ if(get_field('make_posts_open_in_lightbox_option', 'option') || get_field('make_posts_open_in_lightbox')) $lightbox_class = 'lightbox-tiles'; else $lightbox_class = ''; return $lightbox_class; } function os_get_show_sidebar_on_masonry() { if(isset($_SESSION['show_sidebar_on_masonry'])){ if($_SESSION['show_sidebar_on_masonry'] == 'yes'){ $show_sidebar_on_masonry = true; }else{ $show_sidebar_on_masonry = false; } }else{ $show_sidebar_on_masonry = get_field('show_sidebar_on_masonry_page', 'option'); } return $show_sidebar_on_masonry; } function os_get_use_fixed_height_index_posts() { if(isset($_SESSION['use_fixed_height_index_posts'])){ if($_SESSION['use_fixed_height_index_posts'] == 'yes'){ $use_fixed_height_index_posts = true; }else{ $use_fixed_height_index_posts = false; } }else{ global $forse_fixed_height; if(!isset($forse_fixed_height)) $forse_fixed_height = false; if($forse_fixed_height == true){ $use_fixed_height_index_posts = true; }else{ $use_fixed_height_index_posts = get_field('use_fixed_height_index_posts', 'option'); } } return $use_fixed_height_index_posts; } function os_get_show_featured_posts_on_index() { $show_featured_posts_on_index = osetin_get_field('featured_posts_slider'); return $show_featured_posts_on_index; } function os_get_featured_posts_type_on_index() { $featured_posts_type_on_index = osetin_get_field('featured_slider_type'); return $featured_posts_type_on_index; } /** * Osetin themes helpers functions * * @package Jupiter * */ function osetin_translate_column_width_to_span( $width = '' ){ switch ( $width ) { case "1/12" : $column_class = "col-sm-1"; break; case "1/6" : $column_class = "col-sm-2"; break; case "1/4" : $column_class = "col-sm-3"; break; case "1/3" : $column_class = "col-sm-4"; break; case "5/12" : $column_class = "col-sm-5"; break; case "1/2" : $column_class = "col-sm-6"; break; case "7/12" : $column_class = "col-sm-7"; break; case "2/3" : $column_class = "col-sm-8"; break; case "3/4" : $column_class = "col-sm-9"; break; case "5/6" : $column_class = "col-sm-10"; break; case "11/12" : $column_class = "col-sm-11"; break; case "1/1" : $column_class = "col-sm-12"; break; default : $column_class = "col-sm-12"; } return $column_class; } /** * Get url for the color directory with images */ function osetin_get_color_images_directory_uri($color = 'blue') { return get_template_directory_uri() . "/assets/images/colors/" . $color; } /** * Get url for the color directory with images */ function osetin_get_images_directory_uri() { return get_template_directory_uri() . "/assets/images"; } function osetin_generate_sub_bar($woo = false){ echo ''; } function osetin_get_field($field_name, $post_id = false, $default = ''){ if(function_exists('get_field')){ $field_value = get_field($field_name, $post_id); if(empty($field_value) && $default != '') return $default; else return $field_value; }else{ return $default; } } function osetin_social_share_icons($location){ } function osetin_output_breadcrumbs(){ echo ''; } function osetin_get_media_content($size = false, $forse_single = false) { switch(get_post_format()): case "video": ?>
run_shortcode('[embed]'.get_field('video_url').'[/embed]'); ?>
$img_src, 'alt' => $image['alt'])); } if($max_proportion > 0) $padding_style = 'padding-bottom: '.$max_proportion.'%;'; ?>
>
    '.$image_arr['alt'].''; } ?>
pluto
'; $key++; break; case 'html': $output = '
'.$current_ad_block['ad_html'].'
'; $key++; break; } } } } $os_current_box_counter++; if($do_echo){ echo $output; }else{ return $output; } } function os_output_post_thumbnail($size = false, $forse_single = false) { if(has_post_thumbnail()): if(is_single() || $forse_single): ?>
'; ?>
$post->post_parent, 'fields' => 'ids', 'numberposts' => -1, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID', ) ); // If there is more than 1 attachment in a gallery... if ( count( $attachment_ids ) > 1 ) { foreach ( $attachment_ids as $attachment_id ) { if ( $attachment_id == $post->ID ) { $next_id = current( $attachment_ids ); break; } } // get the URL of the next image attachment... if ( $next_id ) { $next_attachment_url = get_attachment_link( $next_id ); } // or get the URL of the first image attachment. else { $next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) ); } } printf( '%2$s', esc_url( $next_attachment_url ), wp_get_attachment_image( $post->ID, $attachment_size ) ); } endif;