https://github.com/quickdevelopment/wp-js
Get all your public wordpress data through the WP API using a tree-shakable typescript library.
https://github.com/quickdevelopment/wp-js
rest-api typescript wp-api wp-js
Last synced: 6 months ago
JSON representation
Get all your public wordpress data through the WP API using a tree-shakable typescript library.
- Host: GitHub
- URL: https://github.com/quickdevelopment/wp-js
- Owner: QuickDevelopment
- License: mit
- Created: 2024-01-13T18:06:50.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-03T14:22:32.000Z (12 months ago)
- Last Synced: 2025-07-11T18:17:46.455Z (7 months ago)
- Topics: rest-api, typescript, wp-api, wp-js
- Language: TypeScript
- Homepage: https://quickdevelopment.github.io/wp-js/
- Size: 1.43 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
@quickdevelopment/wp-js ·
Get all your public WordPress data through the WP API using a tree-shakable TypeScript library.
Table of Contents
## Installation
```
npm install @quickdevelopment/wp-js
```
## Usage
### Setting the Config
```
// src/main.ts
import { ConfigManager } from "@quickdevelopment/wp-js";
ConfigManager.getInstance({
// Replace with your WordPress API URL
apiUrl: 'https://developer.wordpress.org/wp-json/wp/v2',
embed: true
});
```
### Retrieve Posts
This is an example of how to retrieve posts from your WordPress site using the `Post` class.
```
import {Post, PostDataType} from "@quickdevelopment/wp-js";
const posts = new Post()
posts.fetch().then((posts: PostDataType[]) => {
console.log(posts);
})
.catch((err) => {
console.log(err);
});
```
## Documentation
For more information about the library, see the [documentation](https://quickdevelopment.github.io/wp-js/).
## Coming up
- [x] Add more API classes to retrieve data from the WP API
- [ ] Examples of how to use the library in multiple contexts
- [x] Add a documentation site
## Contributing
If you want to contribute to this project, see [CONTRIBUTING](CONTRIBUTING) for details.
## License
MIT © Quickdevelopment. See [LICENSE](LICENSE) for details.
[coveralls-image]:https://coveralls.io/repos/github/quickdevelopment/wp-js/badge.svg?branch=main
[coveralls-url]:https://coveralls.io/github/quickdevelopment/wp-js?branch=main