Download the PHP package vendi-advertising/vendi-cpt-from-yaml without Composer
On this page you can find all versions of the php package vendi-advertising/vendi-cpt-from-yaml. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vendi-advertising/vendi-cpt-from-yaml
More information about vendi-advertising/vendi-cpt-from-yaml
Files in vendi-advertising/vendi-cpt-from-yaml
Package vendi-cpt-from-yaml
Short Description Loads CPTs from a yaml file
License MIT
Informations about the package vendi-cpt-from-yaml
Custom Post Types (CPTs)
Vendi stores CPT information in YAML files and uses this library for parsing and loading CPTs. Although there is a very slight overhead in doing this, the front-end caching will offset this completely. For sites that don't have a front-end cache, the YAML file could be additionally parsed and stored in a transient.
Location and File Name
The config file is generally stored in a folder off of the theme's root called .config
with a name of cpts.yaml
. You
may also create an environment variable called CPT_YAML_FILE
that points either to the absolute path of the config
file, or a path relative to the theme's directory.
Options
The file format is very simple and is intended for the 99% use case for CPTs. There are no features in the YAML file
that aren't available to the traditional register_post_type
WordPress function.
- The root key is the WordPress slug for the CPT
- Because this is the slug, just like any other CPT, you should never change this once you've defined it or else your existing content might get lost.
- The two required child keys are
singular
andplural
which control the display name for the CPT. - Two optional child keys are
singular_lowercase
andplural_lowercase
however if they are not present they will be generated automatically. - The last optional child key is
extended_options
whose values map directly to the core WordPress function register_post_type
Sample
All versions of vendi-cpt-from-yaml with dependencies
symfony/yaml Version ^5|^6
vendi-advertising/vendi-yaml-loader Version ^1|^2|^3