public function children($post_type = 'any', $childPostClass = false)
{
if ($childPostClass === false) {
$childPostClass = $this->PostClass;
}
if ($post_type == 'parent') {
$post_type = $this->post_type;
}
if (is_array($post_type)) {
$post_type = implode('&post_type[]=', $post_type);
}
$query = 'post_parent=' . $this->ID . '&post_type[]=' . $post_type . '&numberposts=-1&orderby=menu_order title&order=ASC&post_status[]=publish';
if ($this->post_status == 'publish') {
$query .= '&post_status[]=inherit';
}
$children = get_children($query);
foreach ($children as &$child) {
$child = new $childPostClass($child->ID);
}
$children = array_values($children);
return $children;
}