function getTemplateGroups($params, $response = array()) { global $wpdb; $table_name = TemplateData::get_tplgroup_table_name(); $query = "SELECT * FROM {$table_name}"; $where = ""; if (isset($params['where'])) { $where[] = $params['where']; } if (!empty($where)) { $query .= " where " . implode(" and ", $where); } $response = $wpdb->get_results($query, ARRAY_A); if (empty($response)) { return array(); } return $response; }