Beispiel #1
0
 /**
  * AJAX search questions by keyword (next version)
  *
  */
 public function search_questions()
 {
     try {
         $query = QA_Questions::search($_POST['content']);
         $data = array();
         foreach ($query->posts as $post) {
             $question = QA_Questions::convert($post);
             $question->et_avatar = QA_Member::get_avatar_urls($post->post_author, 30);
             $question->permalink = get_permalink($post->ID);
             $data[] = $question;
         }
         $resp = array('success' => true, 'msg' => '', 'data' => array('questions' => $data, 'total' => $query->found_posts, 'count' => $query->post_count, 'pages' => $query->max_num_pages, 'search_link' => qa_search_link($_POST['content']['s']), 'search_term' => $_POST['content']['s'], 'test' => $query));
     } catch (Exception $e) {
         $resp = array('success' => false, 'msg' => $e->getMessage());
     }
     wp_send_json($resp);
 }