Your first model
This walkthrough builds a small listing of books: a Book post type, a fieldset of details for each book, and one published entry.
1. Create the post type
Open Post Types and click Create. Enter Book as the singular name and Books as the plural. VX suggests the key book.
The key is how WordPress identifies the post type in the database and in URLs, and you can't change it later. It can be up to 20 characters of lowercase letters, numbers, hyphens and underscores. Pick it as carefully as you'd pick a folder name.
Save. A Books menu now appears in wp-admin.
2. Create a fieldset
Open Fieldsets and click Create. Name it Book details. Its key, book_details, is also permanent.
Add four fields:
| Field type | Label | Key | Why |
|---|---|---|---|
| Select | Format | format | Add the choices Hardcover, Paperback and Ebook. |
| Text | Author name | author_name | Who wrote the book. |
| Image | Author picture | author_picture | A photo of the author. |
| Date | Published | published | When the book came out. |
You can change a label at any time. The key is where values are stored, so leave it alone once people have started saving content.
3. Choose where the fieldset appears
Open the fieldset's Locations tab. Add a Post Type location and select Book. Save the fieldset.
A fieldset without a location appears nowhere. So does a Post Type location with no post types selected.
4. Add a book
In wp-admin, open Books → Add New. Enter a title such as The Glass Library, then open the VX panel in the editor sidebar and fill in the format, author name, author picture and published date. Publish.
The values are saved with the post, like any other WordPress data.
Next steps
- Show the book on a page with dynamic tags.
- Add a Genre taxonomy to group books (Fiction, Mystery, Science fiction).
- Use conditional logic to show a field only when another has a certain value.
- Browse the field types to see what else a book could carry.
Technical details for LLMs
Equivalent config for this walkthrough, as JSON project files (the same vx-config/v1 envelope vx-framework/import-config and vx-framework/validate-config accept):
json
{ "$schema": "vx-config/v1", "type": "post_type", "key": "book",
"config": { "singular_name": "Book", "plural_name": "Books" } }json
{
"$schema": "vx-config/v1",
"type": "fieldset",
"key": "book_details",
"config": {
"label": "Book details",
"fields": [
{ "type": "select", "key": "format", "label": "Format",
"choices": [ { "value": "hardcover", "label": "Hardcover" }, { "value": "paperback", "label": "Paperback" }, { "value": "ebook", "label": "Ebook" } ] },
{ "type": "text", "key": "author_name", "label": "Author name" },
{ "type": "image", "key": "author_picture", "label": "Author picture" },
{ "type": "date", "key": "published", "label": "Published" }
],
"location": { "groups": [ { "object": "post_type", "targets": [ "book" ] } ] }
}
}Validate either payload first with vx-framework/validate-config. Exact config schemas: vx-framework/describe-abilities, vx-framework/get-field-types with include_schemas.