';
echo '
';
$byline = get_query_var('et_post-byline', 'unset'); // unset value to prevent '', true, false as default and correct set query var
if ( $byline == 'unset' ) {
$byline = etheme_get_option('blog_byline', 1);
set_query_var('et_post-byline', $byline);
}
$timeline2 = ! empty( $et_loop['slide_view'] ) && $et_loop['slide_view'] == 'timeline2';
$postClass = get_query_var('et_post-class', false);
if ( !$postClass ) {
$postClass = etheme_post_class( 'grid' );
$postClass[] = 'col-md-6';
set_query_var('et_post-excerpt-length', $postClass);
}
foreach ($posts as $key => $value) {
echo '
';
?>
id="post-ID ); ?>">
'woocommerce_thumbnail', 'in_slider' => true, 'ID' => $value->ID) );
?>
0, 'ID' => $value->ID, 'views_counter' => false, 'in_slider' => true ) ); ?>
ID), true ) ?>
';
}
echo '
';
echo '
';
echo '
';
echo '
';
}
endif;
}
function etheme_portfolio_in_search_results(){
if(!is_search()) return;
global $post;
if( $search_query = get_search_query() ) :
$args = array(
's' => $search_query,
'post_type' => 'etheme_portfolio',
'post_status' => 'publish',
'ignore_sticky_posts' => 1,
// 'posts_per_page' => 50,
'orderby' => '',
// 'post_type' => array(),
// 'post_status' => 'publish',
'posts_per_page' => 50,
// 'ignore_sticky_posts' => 1,
'post_password' => '',
// 'suppress_filters' => false,
);
$posts = get_posts( $args );
$box_id = rand( 1000, 10000 );
if ( count($posts) ) {
remove_action('woocommerce_no_products_found', 'wc_no_products_found', 10);
printf(
'
%s %s
',
count($posts),
_nx( 'Portfolio found', 'Portfolios found', count($posts), 'Search results page - portfolios found text', 'xstore' )
);
$mobile = 1;
$tablet_land = 2;
$notebook = 3;
$large = 3;
$backup_style = get_query_var('is_mobile', false) ? $mobile : $large;
$backup_style = 'style="width:'.(100/$backup_style).'%"';
$swiper_slide_class_css = '.swiper-container.slider-'.$box_id.':not(.initialized) .swiper-slide';
$media = $swiper_slide_class_css .' {width: '.(100/$mobile).'% !important;}';
$media .= '@media only screen and (min-width: 640px) { '.$swiper_slide_class_css.' {width: '.(100/$tablet_land).'% !important;}}';
$media .= '@media only screen and (min-width: 1024px) { '.$swiper_slide_class_css.' {width: '.(100/$notebook).'% !important;}}';
$media .= '@media only screen and (min-width: 1370px) { '.$swiper_slide_class_css.' {width: '.(100/$large).'% !important;}}';
wp_add_inline_style( 'xstore-inline-css', $media);
echo '
';
echo '
';
$byline = get_query_var('et_post-byline', 'unset'); // unset value to prevent '', true, false as default and correct set query var
if ( $byline == 'unset' ) {
$byline = etheme_get_option('blog_byline', 1);
set_query_var('et_post-byline', $byline);
}
$timeline2 = ! empty( $et_loop['slide_view'] ) && $et_loop['slide_view'] == 'timeline2';
$postClass = get_query_var('et_post-class', false);
if ( !$postClass ) {
$postClass = etheme_post_class( 'grid' );
$postClass[] = 'col-md-6';
set_query_var('et_post-excerpt-length', $postClass);
}
foreach ($posts as $key => $value) {
echo '
';
?>
id="post-ID ); ?>">
'woocommerce_thumbnail', 'in_slider' => true, 'ID' => $value->ID) );
?>
0, 'ID' => $value->ID, 'views_counter' => false ) ); ?>
ID), true ) ?>
';
}
echo '
';
echo '
';
echo '
';
echo '
';
}
endif;
}
function etheme_posts_in_search_results(){
if(!is_search()) return;
global $post;
if( $search_query = get_search_query() ) :
// wp_reset_postdata();
$args = array(
's' => $search_query,
'post_type' => 'post',
'post_status' => 'publish',
'ignore_sticky_posts' => 1,
'posts_per_page' => 50,
);
$posts = get_posts( $args );
$box_id = rand( 1000, 10000 );
// echo '
' . esc_html__( 'Posts found', 'xstore' ) . '
';
if ( count($posts) ) {
remove_action('woocommerce_no_products_found', 'wc_no_products_found', 10);
printf(
'
%s %s
',
count($posts),
_nx( 'Post found', 'Posts found', count($posts), 'Search results page - posts found text', 'xstore' )
);
$mobile = 1;
$tablet_land = 2;
$notebook = 3;
$large = 3;
$backup_style = get_query_var('is_mobile', false) ? $mobile : $large;
$backup_style = 'style="width:'.(100/$backup_style).'%"';
$swiper_slide_class_css = '.swiper-container.slider-'.$box_id.':not(.initialized) .swiper-slide';
$media = $swiper_slide_class_css .' {width: '.(100/$mobile).'% !important;}';
$media .= '@media only screen and (min-width: 640px) { '.$swiper_slide_class_css.' {width: '.(100/$tablet_land).'% !important;}}';
$media .= '@media only screen and (min-width: 1024px) { '.$swiper_slide_class_css.' {width: '.(100/$notebook).'% !important;}}';
$media .= '@media only screen and (min-width: 1370px) { '.$swiper_slide_class_css.' {width: '.(100/$large).'% !important;}}';
wp_add_inline_style( 'xstore-inline-css', $media);
echo '
';
echo '
';
$byline = get_query_var('et_post-byline', 'unset'); // unset value to prevent '', true, false as default and correct set query var
if ( $byline == 'unset' ) {
$byline = etheme_get_option('blog_byline', 1);
set_query_var('et_post-byline', $byline);
}
$timeline2 = ! empty( $et_loop['slide_view'] ) && $et_loop['slide_view'] == 'timeline2';
$excerpt_length = get_query_var('et_post-excerpt-length', false);
if ( !$excerpt_length ) {
$excerpt_length = etheme_get_option('excerpt_length', 25);
set_query_var('et_post-excerpt-length', $excerpt_length);
}
$postClass = get_query_var('et_post-class', false);
if ( !$postClass ) {
$postClass = etheme_post_class( 'grid' );
$postClass[] = 'col-md-6';
set_query_var('et_post-excerpt-length', $postClass);
}
foreach ($posts as $key => $value) {
echo '
';
?>
id="post-ID ); ?>">
'woocommerce_thumbnail', 'in_slider' => true, 'ID' => $value->ID) );
?>
0, 'ID' => $value->ID, 'in_slider' => true ) ); ?>
ID);
if ( $excerpt_length > 0 ) {
if ( strlen($excerpt) > 0 ) {
$excerpt_length = apply_filters( 'excerpt_length', $excerpt_length );
$excerpt_more = apply_filters( 'excerpt_more', ' ' . '[…]' );
$text = wp_trim_words( $excerpt, $excerpt_length, $excerpt_more );
echo apply_filters( 'wp_trim_excerpt', $text, $text );
}
else {
echo apply_filters( 'the_excerpt', $excerpt );
}
} ?>
ID), true ) ?>
';
}
echo '
';
echo '
';
echo '
';
echo '
';
}
// wp_reset_query();
endif;
}