function pof_output_parents_arr_json($tree_array) { $ret = array(); foreach ($tree_array as $tree_item) { $tmp = new stdClass(); $tmp->type = str_replace('pof_post_', '', $tree_item->post_type); $tmp->title = $tree_item->post_title; $tmp = getJsonItemBaseDetails($tmp, $tree_item); array_push($ret, $tmp); } return $ret; }
function getJsonTasks($parent_id) { $classTask = "POFTREE\\task"; $childs = array(); $args = array('numberposts' => -1, 'posts_per_page' => -1, 'post_type' => 'pof_post_task', 'meta_key' => 'suoritepaketti', 'meta_value' => $parent_id); $the_query = new WP_Query($args); if ($the_query->have_posts()) { while ($the_query->have_posts()) { $the_query->the_post(); $child = new $classTask(); $child = getJsonItemBaseDetails($child, $the_query->post); $child = getJsonItemDetailsTask($child, $the_query->post); $child->title = $the_query->post->post_title; array_push($childs, $child); } } return $childs; }