kasia-plugin-wp-api-menus
v4.0.5
Published
Provides support for the WP-API menus plugin to Kasia
Downloads
31
Maintainers
Readme
Kasia Plugin WP-API Menus
Adds support for the WP-API menus to Kasia
Made with ❤ at @outlandish
Install
npm install --save kasia-plugin-wp-api-menus
Import
// ES2015
import KasiaWpApiMenusPlugin from 'kasia-plugin-wp-api-menus'
// CommonJS
var KasiaWpApiMenusPlugin = require('kasia-plugin-wp-api-menus')
Initialise
Pass to Kasia via the plugins
option:
const { kasiaReducer, kasiaSagas } = Kasia({
WP,
plugins: [KasiaWpApiMenusPlugin]
})
Action creators
import {
fetchMenus, fetchMenu,
fetchThemeLocations, fetchThemeLocation
} from 'kasia-plugin-wp-api-menus'
Dispatch the returned action objects with store.dispatch(<action>)
.
actions.fetchMenus()
Get all menus available.
Menus will be available at store.wordpress.menus
.
actions.fetchMenu(id)
Get a single menu.
- id {Number|String} ID or slug of the menu to fetch
Menu will be available at store.wordpress.menus[id]
.
actions.fetchThemeLocations()
Get all theme menu locations.
Theme locations will be available at store.wordpress.menusLocations
.
actions.fetchThemeLocation(id)
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]
.
Universal Applications
import kasiaPluginWpApiMenus from 'kasia-plugin-wp-api-menus'
kasiaPluginWpApiMenus.preload(WP)
- WP {Object} WP API instance
Returns a single saga generator.
Contributing
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!
Author & License
kasia-plugin-wp-api-menus
was created by Outlandish and is released under the MIT license.