style="background-image:url()">
', ''); } if (is_single()) { the_title('

', '

'); } if (is_search()) { echo('

' . esc_html__('Search Page', 'hasten-lite') . '

'); } ?>
'; // tag before the current crumb $after = ''; // tag after the current crumb echo ''; ?>
theme_location == 'primary') { return $items .= "
  • "; } return $items; } } if (!function_exists('hasten_lite_banner_callback_choice')): function hasten_lite_banner_callback_choice($control) { $banner_setting = $control->manager->get_setting('hasten_lite_theme_options[banner_picker]')->value(); $control_id = $control->id; if ((($control_id == 'hasten_lite_theme_options[hasten_featured_page_slider_1]') || ($control_id == 'hasten_lite_theme_options[hasten_featured_page_slider_2]') || ($control_id == 'hasten_lite_theme_options[hasten_featured_page_slider_3]') || ($control_id == 'hasten_lite_theme_options[hasten_featured_page_slider_4]')) && $banner_setting == 'banner-slider') { return true; } if (($control_id == 'hasten_lite_theme_options[single_link1]' || $control_id == 'hasten_lite_theme_options[single_link2]' || $control_id == 'hasten_lite_theme_options[single_btn1]' || $control_id == 'hasten_lite_theme_options[single_btn2]' || $control_id == 'hasten_lite_theme_options[slider_image_title]' || $control_id == 'hasten_lite_theme_options[slider_image_description]' || $control_id == 'hasten_lite_theme_options[upload_banner_image]') && $banner_setting == 'banner-image') { return true; } return false; } endif; //banner starts if (!function_exists('hasten_lite_slider_default_query')) { function hasten_lite_slider_default_query() { global $post; $hasten_settings = hasten_lite_get_theme_options(); $hasten_total_page_no = 0; $hasten_list_page = array(); for ($i = 1; $i <= 2; $i++) { if (isset ($hasten_settings['hasten_featured_page_slider_' . $i]) && $hasten_settings['hasten_featured_page_slider_' . $i] > 0) { $hasten_total_page_no++; $hasten_list_page = array_merge($hasten_list_page, array(esc_attr($hasten_settings['hasten_featured_page_slider_' . $i]))); } } if (!empty($hasten_list_page) && $hasten_total_page_no > 0) { $get_featured_posts = new WP_Query(array('posts_per_page' => 2, 'post_type' => array('page'), 'post__in' => $hasten_list_page, 'orderby' => 'post__in',)); $i = 0; ?>
    have_posts()):$get_featured_posts->the_post(); $image_src = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $i++; if (!empty($image_src)) { $image_style = "style='background-image:url(" . esc_url($image_src[0]) . ")'"; } else { $image_style = ""; } ?>
    >
    >
    '; } else { return; } } } if (!function_exists('hasten_lite_limit_title')) { function hasten_lite_limit_title($text, $chars_limit) { // Change to the number of characters you want to display $chars_text = strlen($text); $text = $text . " "; $text = substr($text, 0, $chars_limit); $text = substr($text, 0, strrpos($text, ' ')); // If the text has more characters that your limit, //add ... so the user knows the text is actually longer if ($chars_text > $chars_limit) { $text = $text . "…"; } return $text; } } if (!function_exists('hasten_lite_archive_link')) { function hasten_lite_archive_link($post) { $year = date('Y', strtotime($post->post_date)); $month = date('m', strtotime($post->post_date)); $day = date('d', strtotime($post->post_date)); $link = site_url('') . '/' . $year . '/' . $month . '?day=' . $day; return $link; } } if (!function_exists('hasten_lite_is_url')): function hasten_lite_is_url($uri) { if (preg_match('/^(http|https):\\/\\/[a-z0-9_]+([\\-\\.]{1}[a-z_0-9]+)*\\.[_a-z]{2,5}' . '((:[0-9]{1,5})?\\/.*)?$/i', $uri)) { return $uri; } else { return false; } } endif; if (!function_exists('hasten_lite_get_excerpt')) : function hasten_lite_get_excerpt($post_id, $count) { $content_post = get_post($post_id); $excerpt = $content_post->post_content; $excerpt = strip_shortcodes($excerpt); $excerpt = strip_tags($excerpt); $excerpt = preg_replace('/\s\s+/', ' ', $excerpt); $excerpt = preg_replace('#\[[^\]]+\]#', ' ', $excerpt); $strip = explode(' ', $excerpt); foreach ($strip as $key => $single) { if (!filter_var($single, FILTER_VALIDATE_URL) === false) { unset($strip[$key]); } } $excerpt = implode(' ', $strip); $excerpt = substr($excerpt, 0, $count); if (strlen($excerpt) >= $count) { $excerpt = substr($excerpt, 0, strripos($excerpt, ' ')); $excerpt = $excerpt . '…'; } return $excerpt; } endif; if (!function_exists('hasten_lite_post_excerpt')) { function hasten_lite_post_excerpt($post_content, $count) { $excerpt = $post_content; $excerpt = strip_tags($excerpt); $excerpt = strip_shortcodes($excerpt); $excerpt = preg_replace('/\s\s+/', ' ', $excerpt); $strip = explode(' ', $excerpt); foreach ($strip as $key => $single) { if (!filter_var($single, FILTER_VALIDATE_URL) === false) { unset($strip[$key]); } } $excerpt = implode(' ', $strip); $excerpt = substr($excerpt, 0, $count); if (strlen($excerpt) >= $count) { $excerpt = substr($excerpt, 0, strripos($excerpt, ' ')); $excerpt = $excerpt . '…'; } return $excerpt; } } if (!function_exists('hasten_lite_excerpt_more')) { function hasten_lite_excerpt_more($more) { if ( ! is_admin() ) return ''; else return $more ; } } add_filter('excerpt_more', 'hasten_lite_excerpt_more'); add_action('hasten_lite_head_navigation', 'hasten_lite_navigation_head'); if (!function_exists('hasten_lite_site_description')) { function hasten_lite_site_description() { $description = get_bloginfo('description', 'display'); if ((function_exists('the_custom_logo') && has_custom_logo())) { the_custom_logo(); } else { ?> '; } else { echo '
    '; } if (is_user_logged_in() && current_user_can('edit_theme_options')) { echo ' ' . esc_html__('Add Footer Widget', 'hasten-lite') . ''; } echo '
    '; } } add_action('hasten_lite_header', 'hasten_lite_header_default'); if (!function_exists('hasten_lite_header_default')) { function hasten_lite_header_default() { ?>
    'primary', 'container' => 'ul', 'menu_class' => '', 'walker' => new hasten_lite_nav_walker(), 'fallback_cb' => 'hasten_lite_nav_walker::fallback' )); ?>
    ID)); $ori_url = explode("\n", esc_html($content)); $url = $ori_url[0]; $url_type = explode(" ", $url); $url_type = explode("[", $url_type[0]); if (isset($url_type[1])) { $url_type_shortcode = $url_type[1]; } $new_content = get_shortcode_regex(); if (isset($url_type[1])) { if (preg_match_all('/' . $new_content . '/s', $post->post_content, $matches) && array_key_exists(2, $matches) && in_array($url_type_shortcode, $matches[2]) ) { echo do_shortcode($matches[0][0]); } } else { echo wp_oembed_get(hasten_lite_the_featured_video($content)); } } elseif ($post_format == 'gallery') { $image_url = get_post_gallery_images($post_id); $post_thumbnail_id = get_post_thumbnail_id($post_id); $attachment = get_post($post_thumbnail_id); if ($image_url) { ?>
    $images) { ?>
    '; echo ''; the_post_thumbnail(); echo '
    '; } else { the_post_thumbnail(); } } } else { if (has_post_thumbnail() && !is_single() && is_page_template('page-templates/template-home.php')) { echo ''; } else { the_post_thumbnail(); } } } } if (!function_exists('hasten_lite_the_featured_video')) { function hasten_lite_the_featured_video($content) { $ori_url = explode("\n", $content); $url = $ori_url[0]; $w = get_option('embed_size_w'); if (is_single() || is_archive() || is_search() || is_page_template('page-templates/template-home.php')) { $url = str_replace('448', $w, $url); return $url; } if (0 === strpos($url, 'https://') || 0 == strpos($url, 'http://')) { echo esc_url(wp_oembed_get($url)); $content = trim(str_replace($url, '', $content)); } elseif (preg_match('#^<(script|iframe|embed|object)#i', $url)) { $h = get_option('embed_size_h'); echo esc_url($url); if (!empty($h)) { if ($w === $h) $h = ceil($w * 0.75); $url = preg_replace( array('#height="[0-9]+?"#i', '#height=[0-9]+?#i'), array(sprintf('height="%d"', $h), sprintf('height=%d', $h)), $url ); echo esc_url($url); } $content = trim(str_replace($url, '', $content)); } } } if (!function_exists('hasten_lite_single_navigation')) { function hasten_lite_single_navigation($post_id) { global $post; ?>
    'product', 'posts_per_page' => $limit, 'meta_query' => array( 'relation' => 'OR', array( // Simple products type 'key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric' ), array( // Variable products type 'key' => '_min_variation_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric' ) ) ); } elseif ($data == 'feature') { $args = array( 'post_type' => 'product', 'posts_per_page' => $limit, 'tax_query' => array( array( 'taxonomy' => 'product_visibility', 'field' => 'name', 'terms' => 'featured', ), ), ); } elseif ($data == 'total-sales') { $args = array( 'post_type' => 'product', 'meta_key' => 'total_sales', 'orderby' => 'meta_value_num', 'posts_per_page' => $limit, ); } else { $args = array( 'post_type' => 'product', 'posts_per_page' => $limit ); } return $args; } }