+30.2152151245-8 abuse@cms39.com

Themes & templates

A theme is a folder in public/themes/<name>/. Its files belong to the site: core updates never change them.

Files

  • functions.php: loads first; register CSS / JS, hooks and site fields here.
  • header.php, footer.php: the frame of every page.
  • index.php: the page. Per-type templates (e.g. shopping.php) are used when a page has that template.
  • languages/el.php, en.php: the theme texts.

CSS and JavaScript

// functions.php
cms39_register_css('css/theme.css?v=' . filemtime(__DIR__ . '/css/theme.css'), 110);
cms39_register_js_footer('https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js');
cms39_register_js('htmx');   // a named library from the core registry

The ?v= with the file date forces browsers to fetch the new file after every change.

A page template

<?php get_header(); ?>
<h1><?php echo the_title() ?></h1>
<div class="content"><?php echo the_content() ?></div>
<?php echo cms39_menu('footer-1', ['class' => 'list-unstyled']) ?>
<?php get_footer(); ?>

Twig

Page content and templates can use Twig, with CMS functions:

{{ field('home_title') }}
{{ menu('header', {template: 'bootstrap'}) }}
{{ __('theme.read_more') }}
{% for item in menu_tree('footer-1') %}<a href="{{ item.url }}">{{ item.title|e }}</a>{% endfor %}
for more information contact us by
E-MAIL or by phone at (+30) +30.2152151245-8