Component Structure

The structure of a component is defined with JSON.

WordPress use a naming principle of templates through a PHP comment placed at the beginning of file. We grafts to this principle by adding the interpretation of JSON.

JSON need to be formed by a line by item and this following attributes:

<?php
/**
 * Template Name: Homepage
 * Description: mon template d'accueil
 */
?>

By adding the JSON:

<?php
/*
Template Name: Simplicité
Description: WordPress Grid, double col, single title
---------------------------------------------------------------------
{"type": "editor", "name": "Content", "slug": "content"}
---------------------------------------------------------------------
*/
?>

With this interpretation JSON, we can multiply the elements:

<?php
/*
Template Name: Simplicité
Description: WordPress Grid, double col, single title
---------------------------------------------------------------------
{"type": "editor", "name": "Content", "slug": "content"}
{"type": "editor", "name": "Code", "slug": "code"}
{"type": "link", "name": "Url", "slug": "url"}
{"type": "image", "name": "Illustration", "slug": "illustration"}
---------------------------------------------------------------------
*/
?>