%s %s', $count, _nx( 'Product found', 'Products found', $count, 'Search results page - products found text', 'xstore' ) ); }, 20 ); } $i = 10; foreach ( $search_content as $key => $value ) { if ( $value == 'products' && woocommerce_product_loop() ) { $i = 20; } elseif( isset($_GET['et_search']) && $value != 'products' ) { if ($i == 10) { if ( in_array($value, $search_content) ) { add_action('etheme_before_product_loop_start','etheme_' . $value . '_in_search_results', $key + 10); } } else { if ( in_array($value, $search_content) ) { add_action('etheme_after_product_loop_end','etheme_' . $value . '_in_search_results', $key + 10); } } } } } function etheme_pages_in_search_results(){ if(!is_search()) return; global $post; if( $search_query = get_search_query() ) : $args = array( 's' => $search_query, 'post_type' => 'page', '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( 'Page found', 'Pages found', count($posts), 'Search results page - pages 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 '
'; } 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 '
'; } 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 '
'; } // wp_reset_query(); endif; }