PHP code example of hingst / layotter
1. Go to this page and download the library: Download hingst/layotter library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hingst / layotter example snippets
class Text_Element extends Layotter_Element {
protected function attributes() {
$this->title = 'Text';
$this->description = 'A very simple text element.';
$this->icon = 'font'; // pick an icon from Font Awesome
$this->field_group = 'group_abc1337'; // your ACF field group
}
protected function frontend_view($fields) {
echo $fields['content']; // what visitors will see
}
protected function backend_view($fields) {
echo $fields['content']; // what editors will see
}
}
Layotter::register_element('text', 'Text_Element');