+30.2152151245-8 abuse@cms39.com

Site fields hold values that do not belong to a single page: logo, phone, home page texts, social links. The administrator fills them in under Theme → Site fields and the theme renders them wherever it needs.

Defining fields in the theme

// functions.php
HookManager::addHook('cms39_fields_register', function (array $groups) {
    $groups['header'] = ['title' => 'Header', 'sort' => 10, 'fields' => [
        'site_logo'   => ['label' => 'Logo', 'type' => 'image', 'multilang' => false],
        'site_slogan' => ['label' => 'Slogan', 'type' => 'text', 'help' => 'Below the logo'],
    ]];
    return $groups;
});

Types: text, textarea, editor, image, file, link, number, select, repeater. Fields with 'multilang' => true have one value per language.

Rendering

echo cms39_field('site_slogan', 'e');     // HTML-escaped
echo cms39_field('site_logo', 'url');     // image URL
echo cms39_field('site_logo', 'img');     // ready <img> tag
$slides = cms39_field('home_slides');      // repeater → array of rows

In Twig: {{ field('site_slogan') }}. In page content: the [field name="site_slogan"] shortcode.

Hooks

  • cms39_field_value (filter): changes the value before it reaches the theme.
  • cms39_fields_saved (action): after every save.
for more information contact us by
E-MAIL or by phone at (+30) +30.2152151245-8