Content model

Declare the kinds of content your site needs, such as features, courses or team members, with their fields, and show them with blocks and patterns, without a plugin for custom fields.

For site owners and developers · Leitvia Studio · Administrator · Checked with Leitvia 1.2.69, Leitvia Studio 1.3.65 and Leitvia Pro 0.8.55

Look at a content type

The content type Features of the SaaS kit. The video has no sound; the transcript below has the text of every step.
Transcript of the video
  1. Under Leitvia Studio, Content Model, each content type lists its fields and entries.
  2. JSON (for experts) shows the whole model as JSON, for agents, WP-CLI and other sites.

The terms

  • Content type: a kind of entry, such as Features. Its Kind is Post type (entries like posts), Taxonomy (groups like categories) or Repeater (rows inside an entry, such as the dishes of a menu).
  • Field: one value of an entry, such as a date, a short text or an image.
  • Relation: a link from an entry to entries of another type, such as a feature to its integrations.
  • Binding: a block that shows a field instead of fixed text, so the page follows when the entry changes.

Leitvia Studio › Content Model has three tabs: Content types, JSON (for experts) and Site details. Content types lists every type with its key, kind, fields, entries, source and whether AI agents may use it. Click a name to see its fields.

The tab Content types of the Content Model in Leitvia Studio: a table with Features, Integrations, Releases, Customer stories, Feature areas and Integration kinds, each with key, kind, number of fields and entries, source and availability to agents.
The content types the SaaS kit declared.
The content type Features in the Content Model: its fields with key, label and type, and whether AI agents may use its entries.
One content type with its fields.

Add a content type

New types are written as JSON, a plain text format, in the tab JSON (for experts). This example adds Courses with a start date and a place.

  1. Open Leitvia Studio › Content Model, tab JSON (for experts).
  2. In the field Content model as JSON, add the new type under postTypes. An empty field takes the whole example below.
  3. Click Validate. The message The declaration is valid. confirms it; otherwise the list Errors names each problem.
  4. Click Save, then reload the page.
{
	"version": 1,
	"postTypes": {
		"course": {
			"label": "Courses",
			"singularLabel": "Course",
			"public": true,
			"showInAbilities": true,
			"fields": {
				"course_start": { "type": "date", "label": "Start", "required": true },
				"course_place": { "type": "text", "label": "Place" }
			}
		}
	}
}

Courses now has its own entry in the admin menu, and you add courses like posts. showInAbilities lets AI agents read and write its entries; leave it out to keep them away.

The tab JSON (for experts) of the Content Model in Leitvia Studio: the field Content model as JSON with the model of the site, the buttons Validate and Save, and the message The declaration is valid.
The declaration after Validate.

Site details

Site details are single values for the whole site, such as a product name or a support address. Sections read them, so you change them in one place.

  1. Open Leitvia Studio › Content Model, tab Site details.
  2. Fill in the values.
  3. Click Save site details.
The tab Site details of the Content Model in Leitvia Studio with the fields the SaaS kit declared, such as Product name, and the button Save site details.
The site details of the SaaS kit.

Show content on pages

Types that come with a kit of Leitvia Pro bring a ready section. Their list of entries offers it in a bar above the table.

  1. Open the list of entries, for example Features in the admin menu.
  2. In the bar Show Features on a page:, click New page with this section. Or click Insert in the editor to add the section to a page yourself.

New page with this section creates a draft page with the section of the type. The bar appears only for types with such a section.

The list of the entries Features in the admin of WordPress, with the bar Show Features on a page and the buttons New page with this section and Insert in the editor above the table.
The bar above the list of a type that has a section.

To show one field in your own layout, bind a block to it:

  1. Add a Paragraph, Heading, Image or Button, inside a Query Loop for a list of entries.
  2. In the block settings, open the panel Attributes and choose what the block shows: a Content model field, a Site setting or a field of a Related entry. An Icon block can show the Lead symbol of the page.

The block now shows the value. Change the entry or the site detail, and every page that shows it follows.

The editor with a paragraph bound to the site detail Product name: the paragraph shows the product name, and the panel Attributes of the block settings names the connected field.
A paragraph that shows a site detail.

Undo

Changes to the model by an AI agent wait in the Inbox until a person applies them, and roll back from there. Entries are WordPress posts and stay in the database when you change the model.

For developers

The declaration follows schemas/content-model.schema.json of Studio. Types declared in code show as read-only above the field. With WP-CLI, apply runs as a user and needs --user; --dry-run only validates. Binding sources: leitvia/meta, leitvia/setting, leitvia/relation and leitvia/page-symbol. More in the Developer guide.

wp leitvia model get > model.json
wp leitvia model apply model.json --dry-run --user=admin
wp leitvia model apply model.json --user=admin