PHP 클래스 WP_JSON_Menus

부터: 1.0.0
파일 보기 프로젝트 열기: nekojira/wp-api-menus

공개 메소드들

메소드 설명
format_menu_item ( object | array $menu_item, boolean $children = false, array $menu = [] ) : array Format a menu item for JSON API consumption.
get_menu ( integer $id ) : array Get a menu.
get_menu_location ( string $location ) : array Get menu for location.
get_menu_locations ( ) : array Get menu locations.
get_menus ( ) : array Get menus.
get_nav_menu_item_children ( integer $parent_id, array $nav_menu_items, boolean $depth = true ) : array Returns all child nav_menu_items under a specific parent.
register_routes ( array $routes ) : array Register menu routes for WP API.

메소드 상세

format_menu_item() 공개 메소드

Format a menu item for JSON API consumption.
부터: 1.1.0
public format_menu_item ( object | array $menu_item, boolean $children = false, array $menu = [] ) : array
$menu_item object | array the menu item
$children boolean get menu item children (default false)
$menu array the menu the item belongs to (used when $children is set to true)
리턴 array a formatted menu item for JSON

get_menu() 공개 메소드

Get a menu.
부터: 1.0.0
public get_menu ( integer $id ) : array
$id integer ID of the menu
리턴 array Menu data

get_menu_location() 공개 메소드

Get menu for location.
부터: 1.0.0
public get_menu_location ( string $location ) : array
$location string The theme location menu name
리턴 array The menu for the corresponding location

get_menu_locations() 공개 정적인 메소드

Get menu locations.
부터: 1.0.0
public static get_menu_locations ( ) : array
리턴 array All registered menus locations

get_menus() 공개 정적인 메소드

Get menus.
부터: 1.0.0
public static get_menus ( ) : array
리턴 array All registered menus

get_nav_menu_item_children() 공개 메소드

Returns all child nav_menu_items under a specific parent.
부터: 1.1.0
public get_nav_menu_item_children ( integer $parent_id, array $nav_menu_items, boolean $depth = true ) : array
$parent_id integer the parent nav_menu_item ID
$nav_menu_items array navigation menu items
$depth boolean gives all children or direct children only
리턴 array returns filtered array of nav_menu_items

register_routes() 공개 메소드

Register menu routes for WP API.
부터: 1.0.0
public register_routes ( array $routes ) : array
$routes array Existing routes
리턴 array Modified routes