Knowledge Base

Extending theme with elements

How to extend theme packed already with elements
on Friday 30 August 2019
comments: 0

 Next text is just shortcut list of needed things to do. It supposes that you know how JM Elements works.

 You can create your own options and your own templates. If you don't want override already existing files, you should create folder custom inside elements and templates folder.

Rules for options are:

- 1. set - default options from plugin itself (folder default in plugin)

- 2. set - theme options from theme (folder elements in theme)

- 3. set - custom theme options from theme (folder elements/custom in theme)

Rules for templates are:

- 1. set - default template from plugin itself (folder templates, file default_template, array name $DEFAULT_TEMPLATE) -  this can be overridden by copying to theme folder. No merging. 

- 2. set  - theme template from theme itself (folder templates/jmelements, file theme_template, array name $THEME_TEMPLATE)

- 3. set - custom theme templates (folder templates/jmelements, file custom_template, array name $CUSTOM_TEMPLATE)

Inside template folders are other template files. They are used for dropdown options for element fields. They can be overridden standard way with theme templates. Prepacked ones are:


$TEXTCOLOUR_TEMPLATE['text-primary'] = 'text-primary';
$TEXTCOLOUR_TEMPLATE['text-secondary'] = 'text-secondary';
$TEXTCOLOUR_TEMPLATE['text-success'] = 'text-success';
$TEXTCOLOUR_TEMPLATE['text-warning'] = 'text-warning';
$TEXTCOLOUR_TEMPLATE['text-info'] = 'text-info';
$TEXTCOLOUR_TEMPLATE['text-light'] = 'text-light';

It has to be done this way because in the admin area you are able to work only with first key of frontend templates.