Optional
endpoint: stringPrivate
_searchPrivate
_slugProtected
endpointStatic
Protected
_instanceSet the author.
2.0.0
This will set the author. This is useful if you want to get posts from different authors while keeping the same Post instance.
import {Post} from "@quickdevelopment/wp-js";
const authorPosts = new Post();
authorPosts.byAuthor(1).fetch().then((posts) => {
// This will return the posts from author with id 1.
console.log(posts)
})
Set the searchTerm.
2.0.0
This will set the searchTerm. This is useful if you want to get posts from different searchTerms while keeping the same Post instance.
import {Post} from "@quickdevelopment/wp-js";
const searchTermPosts = new Post();
searchTermPosts.bySearchTerm('hello-world').fetch().then((posts) => {
// This will return the post from search term 'hello-world'.
console.log(posts)
})
Set the slug.
2.0.0
This will set the slug. This is useful if you want to get posts from different slugs while keeping the same Post instance.
import {Post} from "@quickdevelopment/wp-js";
const slugPost = new Post();
slugPost.bySlug('hello-world').fetch().then((post) => {
// This will return the post from slug 'hello-world'.
console.log(post)
})
Protected
fetchProtected
getProtected
getProtected
setStatic
getGet the instance of the WPJSSingleton class.
1.0.0
Generated using TypeDoc
Post class.
Since
2.0.0