Skip to content

Commit

Permalink
add get menu and add get list menu
Browse files Browse the repository at this point in the history
  • Loading branch information
notslang committed Feb 3, 2014
1 parent af9f622 commit 05609a6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
16 changes: 16 additions & 0 deletions controllers/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,22 @@ public function get_page_index() {
);
}

public function get_menu() {
global $json_api;
$menu = $json_api->introspector->get_menu();
return array(
'menu' => $menu
);
}

public function get_list_menu() {
global $json_api;
$menu = $json_api->introspector->get_list_menu();
return array(
'menus' => $menu
);
}

public function get_nonce() {
global $json_api;
extract($json_api->query->get(array('controller', 'method')));
Expand Down
14 changes: 14 additions & 0 deletions singletons/introspector.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,20 @@ public function get_categories($args = null) {
return $categories;
}

public function get_menu() {
global $json_api;
extract($json_api->query->get(array('name')));
$items = wp_get_nav_menu_items($name);
return $items;
}

public function get_list_menu() {
global $json_api;
$menus = get_terms('nav_menu');
//$items = get_registered_nav_menus();
return $menus;
}

public function get_current_post() {
global $json_api;
extract($json_api->query->get(array('id', 'slug', 'post_id', 'post_slug')));
Expand Down

0 comments on commit 05609a6

Please sign in to comment.