$insta_data['image_num'] ) { break; } $i++; if ( $insta_data['resolution'] == 'low_resolution' || $insta_data['resolution'] == 'low_resolution_crop' || $insta_data['resolution'] == 'standard_resolution' || $insta_data['image_resolution'] == 'standard_resolution_crop' ) { $image = $item['large']; } else { $image = $item[ $insta_data['resolution'] ]; } $media_tag = ""; $content = '
'; } die(); } add_action( 'wp_ajax_kite-instagram-generate-dom', 'kite_instagram_generate_dom' ); add_action( 'wp_ajax_nopriv_kite-instagram-generate-dom', 'kite_instagram_generate_dom' ); /*-----------------------------------------------------------------*/ // Ajax Search /*-----------------------------------------------------------------*/ if ( ! function_exists( 'kite_ajax_search' ) ) { function kite_ajax_search() { $default_post_type = kite_woocommerce_installed() ? 'product' : 'post'; $search_post_type = kite_opt( 'search_post_type', $default_post_type ); $s = strtolower( trim( sanitize_text_field( $_GET['s'] ) ) ); $cat = trim( sanitize_text_field( $_GET['cat'] ) ); $results = []; if ( $cat == 'all' ) { $args = array( 's' => $s, 'post_type' => $search_post_type, 'posts_per_page' => 20, 'no_found_rows' => 1, ); } else { if ( $search_post_type == 'product' ) { $args = array( 's' => $s, 'post_type' => $search_post_type, 'posts_per_page' => 20, 'no_found_rows' => 1, 'product_cat' => $cat, ); } else { $args = array( 's' => $s, 'post_type' => $search_post_type, 'posts_per_page' => 20, 'no_found_rows' => 1, 'category_name' => $cat, ); } } global $post; $args['suppress_filters'] = 0; /** * Modify ajax search args before doing search process */ $args = apply_filters( 'kite_ajax_search_args', $args ); $posts = get_posts( $args ); if ( $search_post_type == 'product' ) { $args_sku = array( 'post_type' => 'product', 'posts_per_page' => 20, 'meta_query' => array( array( 'key' => '_sku', 'value' => $s, 'compare' => 'like', ), ), 'suppress_filters' => 0, ); $products_sku = get_posts( $args_sku ); $all_search_results = array_merge( $posts, $products_sku ); $products_id = array(); foreach ( $all_search_results as $key => $product ) { $id = $product->ID; if ( in_array( $id, $products_id ) ) { unset( $all_search_results[ $key ] ); } else { $products_id[] = $id; } } } if ( $search_post_type != 'product' ) { $all_search_results = $posts; } if ( count( $all_search_results ) > 0 ) { if ( ! empty( $_GET['result_columns'] ) ) { $columns = 'columns-' . sanitize_text_field( $_GET['result_columns'] ); } else { $columns = kite_opt( 'search_result_columns', false ) ? '' : 'columns-2'; } /** * Kite before search items loop * * @hooked - kite_change_price_style_in_ajax_search */ do_action( 'kite_before_ajax_search_items_loop', $search_post_type ); if ( kite_opt( 'trident_search_enabled_items', true ) ) { $items = 'product' == $search_post_type ? esc_html__( 'Products', 'teta-lite' ) : esc_html__( 'Posts', 'teta-lite' ); $results[] = "