array('post', 'product'), 'posts_per_page' => 15, 's' => $s_key, ); $queried_posts = get_posts($args); $sldttl = count($queried_posts); $markup = ""; $markup .= '
'; foreach ($queried_posts as $q_post) { $sid = $q_post->ID; if ($q_post->post_type == 'product') { $s_prod_obj = wc_get_product($sid); $markup .= '

'.get_the_title($sid).'

'.$s_prod_obj->get_price().' '.get_woocommerce_currency_symbol().'

'; if (!empty($src_rslt_itm_cursor_src_url)) { $markup .= 'Result Button'; } $markup .= '
'; } else { $markup .= '
'; } } $markup .= '
'; $output_data[] = array( 'markup' => $markup, 'sld_count' => $sldttl ); echo json_encode($output_data); die(); }