Every object in Plate consists of a content type with no attributes, apart from some defaults, like
title. You can set attributes by adding content fields to a content type. The user will then be able to set values in the created attributes in Plate’s edit mode.
Content Types video tutorial (Dutch):
Plate recognizes two kinds of content types:
Editable inline elements with partials as theme files. Represented by the
Content Element in the Plate Nested Layout Structure. E.g. images, galleries, editable texts, etc.
Objects that are approachable via a url. E.g. pages, categories, blog posts, etc. their theme files inherit directly from a theme layout. It has two different templates:
show. The role of
index is that of an overview page,
show the detail page. However,
index is a single page too, but with the
index.plate theme file. This way users can change the same attributes for overview pages as detail pages, like header photos etc. Layoutable content types (post types) have URL’s based on their on their objects’ slugs.
Both content types’ objects can be referenced in the reference content field.
When creating content types you have to provide the following data:
These are used to define the content type in the edit screens, visible for the end user while adding or editing the objects with this content type.
These are used to define the content type inside the templating engine. These have to be parameterized (downcased, underscores instead of spaces). The singular name will be the variable that calls the object, on which you can call attributes. E.g.
category.name will return ‘Cats and Dogs’, because you have an object with post type ‘Category’, and it’s name is ‘Cats and Dogs’.
This is the icon that is used along with the titles in the edit screens.
For Post types you have to type in the slug for each language your site is available in. The slug is the word that will be the first part of the url for the post:
/:content-type-slug/:object-slug. For example, in the case of the post type Categories:
/categories/cats-and-dogs. In this case,
categories is the slug for the Categories post type,
cats-and-dogs the slug for the post (object with post type ‘Category’).
A site always has a root post type (usually Page) that hides the post type’s slug from the url. That means that
/page-slug work, and Plate recognizes ‘Page’ as the selected Post type.
Let’s say you want to make a ‘Colored Button’ element content type. You’ll fill out the following data:
crop_16_9. This Material icon doesn’t have anything to do with buttons, but it kinda looks like a button, so…
Now the end user can create actual Colored Button elements. How these buttons look like is up to you: you’ll probably need to add content fields to them, and have to create a theme file for it in your theme:
Fill out the necessary fields (see About Content Types to learn more about the functions of this data).
Every Plate site must have a bare minimum of content types, so there are a couple of defaults that you cannot edit or delete. You can extend them with extra custom content fields. The following is a list of default content types and their default content fields.
Inline editable text. Default content fields:
A single image. Default content fields:
Contact form. Default content fields:
Multiple images. Default content fields:
Inline HTML code. Default content fields:
Inline menu. Default content fields:
Post type for blog posts. (post type with the name posts. Confusing, we know.) No default content fields.
Post type for regular pages. No default content fields.