We have added support for Custom Post Types and Custom Taxonomies!
You just need to configure them in your frontity.settings.js
β inside the wp-source
package β adding the following options:
-
postTypes
: array of post type definitions with the propertiestype
,endpoint
andarchive
(more info here). -
taxonomies
: array of taxonomy definitions with the propertiestaxonomy
,endpoint
,postTypeEndpoint
andparams
(more info here).
An example using both options would be:
{
name: "@frontity/wp-source",
state: {
source: {
api: "https://test.frontity.io/wp-json",
postTypes: [
{
type: "movies", // type slug
endpoint: "movies", // REST API endpoint
archive: "/movies-archive" // link where this custom posts are listed
}
],
taxonomies: [
{
taxonomy: "actors", // taxonomy slug
endpoint: "actor", // REST API endpoint
postTypeEndpoint: "movies", // endpoint from which posts from this taxonomy are fetched
}
]
}
}
}
After that, you can cosume and use these Custom Post Types and Taxonomies the same way you were doing with posts and categories or tags before.
Another important updates:
-
We have added the
create-package
command to our CLI. With this command, you can add empty packages to your project and start developing themes and other type of packages from scratch.It has the following syntax:
npx frontity create-package [name] [--namespace <value>]
NOTE: If you donβt specify
name
ornamespace
you will be prompted to do so, as these values are mandatory.The newly created package is ready-to-use β just add it to your
frontity.settings.js
as the rest of packages. -
We have added the
--dont-open-browser
option to thedev
command (the name is self-explanatory). -
We have fixed a problem in the
<Image>
component when using native lazy-loading in Chrome if theheight
prop was not present. -
We also made some improvements to
mars-theme
(#203) and created the packagetype-declarations
(#211).
Features
- cli: add --dont-open-browser option to dev (6ae037c)
- frontity: add create-package command (#218) (eac88fd)
- wp-source: add postTypes and taxonomies arrays to state (8f8fce3)
Bug Fixes
- image: add height prop and set loading=auto if no height is present (9870414)
- core: delete package name from merged store (7428a90)
- typescript: update to latest version (a89b11c)
Versions
- @frontity/components@1.1.13
- @frontity/connect@1.0.3
- @frontity/core@1.3.0
- @frontity/file-settings@1.1.4
- frontity@1.4.1
- @frontity/hooks@1.1.12
- @frontity/html2react@1.1.13
- @frontity/mars-theme@1.2.2
- @frontity/router@1.0.16
- @frontity/source@1.0.15
- @frontity/tiny-router@1.0.16
- @frontity/type-declarations@1.0.1
- @frontity/types@1.1.2
- @frontity/wp-source@1.4.1
- @frontity/yoast@1.1.4