-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Etienne Moureton
committed
Mar 15, 2024
1 parent
eb39131
commit 25dd365
Showing
2 changed files
with
7 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# useWpPost | ||
|
||
`useWpPost` is a composable function that fetches a WordPress post by its slug. It returns a Promise that resolves to a `Post` object. | ||
`useWpPost` is a composable function that fetches a WordPress post by its id. It returns a Promise that resolves to a `Post` object. | ||
|
||
## Usage | ||
```ts | ||
const post = await useWpPost({ type, slug }) | ||
const post = await useWpPost({ type, id }) | ||
``` | ||
|
||
## Parameters | ||
|
||
- `type` (string, optional): The type of the WordPress post to fetch. Defaults to 'posts'. | ||
- `slug` (string, optional): The slug of the WordPress post to fetch. If not provided, the current route path will be used. | ||
- `id` (number, optional): The number of the WordPress post to fetch. If not provided, the current route path will be used. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters