{"id":16040767,"url":"https://github.com/ryelle/wordpress-query-menu","last_synced_at":"2026-05-12T06:33:31.868Z","repository":{"id":57399110,"uuid":"74931429","full_name":"ryelle/wordpress-query-menu","owner":"ryelle","description":null,"archived":false,"fork":false,"pushed_at":"2017-11-27T16:03:46.000Z","size":34,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T18:57:31.145Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryelle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-28T02:54:14.000Z","updated_at":"2023-07-02T17:42:08.000Z","dependencies_parsed_at":"2022-09-13T21:22:03.479Z","dependency_job_id":null,"html_url":"https://github.com/ryelle/wordpress-query-menu","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryelle%2Fwordpress-query-menu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryelle%2Fwordpress-query-menu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryelle%2Fwordpress-query-menu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryelle%2Fwordpress-query-menu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryelle","download_url":"https://codeload.github.com/ryelle/wordpress-query-menu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241715023,"owners_count":20007913,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-08T23:21:25.681Z","updated_at":"2026-05-12T06:33:31.824Z","avatar_url":"https://github.com/ryelle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"WordPress Query Menu\n====================\n\nThis package contains a query component, along with redux state \u0026 selectors for posts pulled from a WordPress site. This uses the [`wordpress-rest-api-oauth-1`](https://github.com/WP-API/wordpress-rest-api-oauth-1) package to get your site's data via Query Components ([inspired by calypso](https://github.com/Automattic/wp-calypso/blob/master/docs/our-approach-to-data.md#query-components)). The Query Components call the API, which via actions set your site's data into the state.\n\nTo use any of these helpers, you'll need to set your Site URL in a global (`SiteSettings`), so that the API knows what site to connect to. For example:\n\n```js\nwindow.SiteSettings = {\n\tendpoint: 'url.com/path-to-wordpress',\n};\n```\n\nAs of version 1.1, the URL should _not_ include `/wp_json` – `wordpress-rest-api-oauth-1` adds that for us.\n\nQueryMenu\n=========\n\nQueryMenu is a React component used in managing the fetching of menu data by theme location.\n\n## Usage\n\nRender the component, passing the requested `location`, the menu location set up by the theme. It does not accept any children, nor does it render any elements to the page. You can use it adjacent to other sibling components which make use of the fetched data made available through the global application state.\n\n```jsx\nimport React from 'react';\nimport QueryMenu from 'wordpress-query-menu';\nimport Navigation from './navigation';\n\nexport default function MyMenu( { menu } ) {\n\treturn (\n\t\t\u003cdiv\u003e\n\t\t\t\u003cQueryMenu location={ 'primary' } /\u003e\n\t\t\t\u003cNavigation menu={ menu } /\u003e\n\t\t\u003c/div\u003e\n\t);\n}\n```\n\n## Props\n\n### `location`\n\n\u003ctable\u003e\n\t\u003ctr\u003e\u003cth\u003eType\u003c/th\u003e\u003ctd\u003eString\u003c/td\u003e\u003c/tr\u003e\n\t\u003ctr\u003e\u003cth\u003eRequired\u003c/th\u003e\u003ctd\u003eYes\u003c/td\u003e\u003c/tr\u003e\n\t\u003ctr\u003e\u003cth\u003eDefault\u003c/th\u003e\u003ctd\u003e\u003ccode\u003enull\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/table\u003e\n\nThe menu location as set by the theme. See [`register_nav_menus`](https://developer.wordpress.org/reference/functions/register_nav_menus/).\n\nMenu Selectors\n==============\n\nYou can import these into your project by grabbing them from the `selectors` file:\n\n```jsx\nimport { getMenu, isRequestingMenu } from 'wordpress-query-menu/lib/selectors';\n```\n\n#### `getMenu( state, location )`\n\n#### `isRequestingMenu( state, location )`\n\nMenu State\n==========\n\nIf you need access to the reducers, action types, or action creators, you can import these from the `state` file. For example, to use this in your global redux state, mix it into your reducer tree like this:\n\n```jsx\nimport menu from 'wordpress-query-menu/lib/state';\n\nlet reducer = combineReducers( { ...otherReducers, menu } );\n```\n\nIf you need to call an action (the query component should take care of this most of the time), you can pull the action out specifically:\n\n```jsx\nimport { requestMenu } from 'wordpress-query-menu/lib/state';\n```\n\n[View the file itself](src/state.js) to see what else is available.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryelle%2Fwordpress-query-menu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryelle%2Fwordpress-query-menu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryelle%2Fwordpress-query-menu/lists"}