Adds support for the WP-API menus to Kasia
Made with ❤ at @outlandish
npm install --save kasia-plugin-wp-api-menus
// ES2015
import KasiaWpApiMenusPlugin from 'kasia-plugin-wp-api-menus'
// CommonJS
var KasiaWpApiMenusPlugin = require('kasia-plugin-wp-api-menus')
Pass to Kasia via the plugins
option:
const { kasiaReducer, kasiaSagas } = Kasia({
WP,
plugins: [KasiaWpApiMenusPlugin]
})
import {
fetchMenus, fetchMenu,
fetchThemeLocations, fetchThemeLocation
} from 'kasia-plugin-wp-api-menus'
Dispatch the returned action objects with store.dispatch(<action>)
.
Get all menus available.
Menus will be available at store.wordpress.menus
.
Get a single menu.
- id {Number|String} ID or slug of the menu to fetch
Menu will be available at store.wordpress.menus[id]
.
Get all theme menu locations.
Theme locations will be available at store.wordpress.menusLocations
.
Get a single theme menu location.
- id {Number|String} ID or slug of the theme menu location to fetch
Menu will be available at store.wordpress.menuLocations[id]
.
import kasiaPluginWpApiMenus from 'kasia-plugin-wp-api-menus'
- WP {Object} WP API instance
Returns a single saga generator.
All pull requests and issues welcome!
- When submitting an issue please provide adequate steps to reproduce the problem.
- PRs must be made using the
standard
code style. - PRs must update the version of the library according to semantic versioning.
If you're not sure how to contribute, check out Kent C. Dodds' great video tutorials on egghead.io!
kasia-plugin-wp-api-menus
was created by Outlandish and is released under the MIT license.