{"id":15692451,"url":"https://github.com/ryelle/wordpress-query-term","last_synced_at":"2025-05-08T02:42:23.729Z","repository":{"id":57399123,"uuid":"71724631","full_name":"ryelle/wordpress-query-term","owner":"ryelle","description":null,"archived":false,"fork":false,"pushed_at":"2019-08-04T12:31:26.000Z","size":243,"stargazers_count":7,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-25T19:49:04.467Z","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-10-23T19:27:19.000Z","updated_at":"2022-10-30T20:42:36.000Z","dependencies_parsed_at":"2022-09-13T21:22:12.827Z","dependency_job_id":null,"html_url":"https://github.com/ryelle/wordpress-query-term","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-term","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryelle%2Fwordpress-query-term/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryelle%2Fwordpress-query-term/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryelle%2Fwordpress-query-term/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryelle","download_url":"https://codeload.github.com/ryelle/wordpress-query-term/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252989670,"owners_count":21836662,"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-03T18:33:28.951Z","updated_at":"2025-05-08T02:42:23.713Z","avatar_url":"https://github.com/ryelle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"WordPress Query Term\n====================\n\nThis package contains a query component, along with redux state \u0026 selectors for posts pulled from a WordPress site. This uses the [`node-wpapi`](https://github.com/WP-API/node-wpapi) 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\nQuery Term\n===========\n\nQuery Term is a React component used in managing the fetching of term metadata.\n\n## Usage\n\nRender the component, passing the requested `termSlug` and `taxonomy`. 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 QueryTerm from 'wordpress-query-term';\nimport MyTermItem from './term-item';\n\nexport default function MyTerm( { term } ) {\n\treturn (\n\t\t\u003cdiv\u003e\n\t\t\t\u003cQueryTerm\n\t\t\t\ttaxonomy={ 'category' }\n\t\t\t\ttermSlug={ 'nature' } /\u003e\n\t\t\t\u003cMyTermItem term={ term } /\u003e\n\t\t\u003c/div\u003e\n\t);\n}\n```\n\n## Props\n\n### `taxonomy`\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 taxonomy for the given term\n\n### `termSlug`\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 slug of the term to fetch\n\nTerm Selectors\n==============\n\nYou can import these into your project by grabbing them from the `selectors` file:\n\n```jsx\nimport { getTerm, isRequestingTerm } from 'wordpress-query-term/lib/selectors';\n```\n\n#### `getTerm( state, globalId )`\n\n#### `isRequestingTerm( state, taxonomy, slug )`\n\n#### `getTermIdFromSlug( state, taxonomy, slug )`\n\nTerm 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 terms from 'wordpress-query-term/lib/state';\n\nlet reducer = combineReducers( { ...otherReducers, terms } );\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 { requestTerm } from 'wordpress-query-term/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-term","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryelle%2Fwordpress-query-term","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryelle%2Fwordpress-query-term/lists"}