Ejemplo n.º 1
0
 /**
  * Pluck a certain field out of an ES response.
  *
  * @see sp_results_pluck
  *
  * @param int|string $field A field from the retuls to place instead of the entire object.
  * @param bool $as_single Return as single (true) or an array (false). Defaults to true.
  * @return array
  */
 public function pluck_field($field = null, $as_single = true)
 {
     $return = array();
     if (!$field) {
         $field = reset($this->es_args['fields']);
     }
     return sp_results_pluck($this->search_results, $field, $as_single);
 }
Ejemplo n.º 2
0
 function _search_and_get_field($args, $field = 'post_name')
 {
     $args = wp_parse_args($args, array('fields' => $field));
     $posts = sp_wp_search($args, true);
     return sp_results_pluck($posts, $field);
 }