2017 © Pedro Peláez
 

wordpress-plugin wp-api-menus

Extends WordPress WP API with menu routes.

image

nekojira/wp-api-menus

Extends WordPress WP API with menu routes.

  • Monday, October 3, 2016
  • by unfulvio
  • Repository
  • 16 Watchers
  • 106 Stars
  • 70 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 45 Forks
  • 24 Open issues
  • 6 Versions
  • 8 % Grown

The README.md

GitHub version Scrutinizer Code Quality Join the chat at https://gitter.im/unfulvio/wp-api-menus, (*1)

WordPress plugin that extends the JSON REST WP API with new routes pointing to WordPress registered menus. Read the WP API documentation., (*2)

Download from WordPress.org, (*3)

New routes available:

  • /menus list of every registered menu.
  • /menus/<id> data for a specific menu.
  • /menu-locations list of all registered theme locations.
  • /menu-locations/<location> data for menu in specified menu in theme location.

Currently, the menu-locations/<location> route for individual menus will return a tree with full menu hierarchy, with correct menu item order and listing children for each menu item. The menus/<id> route will output menu details and a flat array of menu items. Item order or if each item has a parent will be indicated in each item attributes, but this route won't output items as a tree., (*4)

You can alter the V1 data arrangement of each individual menu items and children using the filter hook json_menus_format_menu_item., (*5)

WP API V2

In V1 of the REST API the routes are located by default at wp-json/menus/ etc., (*6)

In V2 the routes by default are at wp-json/wp-api-menus/v2/ (e.g. wp-json/wp-api-menus/v2/menus/, etc.) since V2 encourages prefixing and version namespacing., (*7)

You can alter the V2 data arrangement of the REST response using the filter hooks 1. rest_menus_format_menus to alter the list of menu items returned (e.g from wp-json/wp-api-menus/v2/menus/) 2. rest_menus_format_menu to alter a single menu returned (e.g wp-json/wp-api-menus/v2/menus/<id>) 3. rest_menus_format_menu_item to alter the menu items returned (e.g wp-json/wp-api-menus/v2/menus/<id> items property), (*8)

Contributing

  • Submit a pull request or open a ticket here on GitHub.

The Versions

03/10 2016

dev-master

9999999-dev https://github.com/unfulvio/wp-api-menus

Extends WordPress WP API with menu routes.

  Sources   Download

GPLv2.0+

The Requires

 

wordpress api wp json wp-api wp-rest-api

03/10 2016

1.3.1

1.3.1.0 https://github.com/unfulvio/wp-api-menus

Extends WordPress WP API with menu routes.

  Sources   Download

GPLv2.0+

The Requires

 

wordpress api wp json wp-api wp-rest-api

25/02 2016

1.3.0

1.3.0.0 https://github.com/unfulvio/wp-api-menus

Extends WordPress WP API with menu routes.

  Sources   Download

GPLv2.0+

The Requires

 

wordpress api wp json wp-api wp-rest-api

11/01 2016

1.2.1

1.2.1.0 https://github.com/nekojira/wp-api-menus

Extends WordPress WP API with menu routes.

  Sources   Download

GPLv2.0+

The Requires

 

wordpress api wp json wp-api wp-rest-api

18/10 2015

1.2.0

1.2.0.0 https://github.com/nekojira/wp-api-menus

Extends WordPress WP API with menu routes.

  Sources   Download

GPLv2.0+

The Requires

 

wordpress api wp json wp-api wp-rest-api

19/06 2015

1.1.5

1.1.5.0 https://github.com/nekojira/wp-api-menus

Extends WordPress WP API with menu routes.

  Sources   Download

GPLv2.0+

The Requires

 

wordpress api wp json wp-api wp-rest-api