'wpsc_ticket_thread', 'post_status' => 'publish', 'posts_per_page' => $wpsc_thread_limit+1, 'orderby' => 'date', 'order' => 'DESC', 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'ticket_id', 'value' => $ticket_id, 'compare' => '=' ), array( 'key' => 'thread_type', 'value' => array('reply','report'), 'compare' => 'IN' ), ), )); $auth_id = $wpscfunction->get_ticket_fields($ticket_id, 'ticket_auth_code'); if($threads){ $cntr = 0; foreach ($threads as $thread) { if($cntr==0){ $cntr ++; continue; } $user_name = get_post_meta($thread->ID,'customer_name',true); $attachments = get_post_meta($thread->ID, 'attachments', true); $thread_type = get_post_meta($thread->ID, 'thread_type',true); $thread_type = '(' . $thread_type .')'; $ticket_history .= '