public function convert($data, $class)
{
if (is_array($data)) {
$func = __FUNCTION__;
foreach ($data as &$ele) {
if (gettype($ele) === 'array') {
$ele = $this->{$func}($ele, $class);
} else {
if ($ele instanceof WP_Post) {
$ele = new $class($ele);
}
}
}
}
return $data;
}