• The best import export plugin
  • Supports very large files
  • Simple interface & flexible API
  • Import, Export, Migrate, Bulk Edit

Template Dictionary

by Radovan Kneblík

0 Ratings

Active Installations

10+

Last Update

4 years

Quality

D

Plugin Description

Description
Template Dictionary is a plugin which can be used to create template variables editable by admins.
The plugin is multilingual ready. It includes Polylang integration, another multilingual plugin can be integrated with filters.
Admin pages
There are few admin pages for managing the plugin.
Template Dictionary – view, edit and delete the template variables values
Settings list – view, edit and delete template variables settings
Add setting – add new or edit template variables setting
Edit values – edit a value, this page is accessable from the page Template Dictionary
Export/Import – export settings and values to xml or import it from xml
Usage in template
You can use a value in template by calling function
get
of Template Dictionary object, which can be accessed by function
TmplDict()
.
For example, if you set a setting with code the_code, you can use it’s value by:
TmplDict()->get( ‘the_code’ );
This function returns the value. If you need to echo the value, you can use function
eget
. Both functions have an optional argument
$default
, which is the default returned/echoed value, if the admin value is empty.
You can also get the value by accessing the code as property:
$value = TmplDict()->the_code;
Usage with shortcode
You can also use a shortcode
[tmpl_dict]
with attributes
code
,
default
and
do_shortcode
. The last attribute says, if the function
do_shortcode
will be called on the value.
Setup template language
Default template language can be set by setting the constant
TMPL_DICT_DEFAULT_LANG
in wp-config. Default value of this constant consists of two first characters of the current WP locale. It is important to set the default language constant properly if you plan to create your site multilingual in future.
If you have a multilingual site, you need to set current template language with the filter
template_dictionary_language
. For users of Polylang, it is already integrated in this plugin, the current template language is the Polylang current language slug.
Setup available languages
If you have a multilingual site, you also need to set available languages with the filter
template_dictionary_languages
. Again, if Polylang is activated, these available languages consist of Polylang languages slugs.
If your site is not multilingual, there is only one available language – the default language.
Use JS object
To generate JavaScript dictionary object, you need to define
TMPL_DICT_JS_VAR_NAME
constant. Add to
wp_config.php
:
define( ‘TMPL_DICT_JS_VAR_NAME’, ‘dict’ );
Then you can use it in JS:
$(‘#some-element’).text( dict.the_code );

Similar Plugins

  • Report Bug
The content on this website originates from various sources. All rights to the original content remain with the respective author. If you believe that your copyrights have been infringed by the use of content on this website, please contact us at info@plugin-guru.com. We will remove the content in question immediately.

This is the heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Regular Price

Free download

Key Features

  • You will be redirected to the retailer

Collections

Create your first Collection

To create a collection, simply click on the symbol on the desired plugin.

You can see this symbol when you move the mouse over the plugin. 

Current Level

Plugin Magican

You have reached 0 views on your collections and are currently Plugin Magican. You magically help people find the right plugins and are a great asset to the community

0 of 500 views reached