Just provide a short PHP settings.php with the configuration input fields, and
Replace references to these settings in your template file(s) with get_theme_setting('nameOfSetting', 'defaultValue').
The schema support allows you to easily define multiple settings in *.properties files and enables the user to switch multiple settings at once.
Using the LESS plugin it is also easy to make your CSS files configurable.
Version 0.4:
It now supports the I18N plugin for multilanguage sites: just add class "i18n" to input fields in settings.php to mark fields that might have different values in different languages.
Just a couple issues with the demo theme:
- it requires the I18N plugin (directly calls get_i18n_component in <title>)
- if you leave the Tag Line field empty or enter something like "..." (without quotes) the site is broken (Less fatal error)
Just a couple issues with the demo theme:
- it requires the I18N plugin (directly calls get_i18n_component in <title>)
- if you leave the Tag Line field empty or enter something like "..." (without quotes) the site is broken (Less fatal error)
Thank you for testing. I updated the theme and both the Theme Settings and the LESS plugin to avoid these errors.
2014-07-15, 20:47:06 (This post was last modified: 2014-07-15, 20:57:41 by Tzvook.)
Very useful !!
can give a lot of power to the theme now, getting closer to the way it's done in Wordpress
A few feature requests if I may ...
1. wysiwyg support for textareas fields
2. photo/files fields support , for easily attaching images to theme (logos, backgrounds, sliders, etc').
3. dedicated data dir ( other/ThemeSettings/.... ) for keeping data tidy in case of multiple themes.
But - if mvlcek will include it in the plugin, he'll probably take a look
I don't like to add things to someone else new plugins :-) ... those are just a quick suggestions ....
(2015-04-08, 19:58:34)Oleg06 Wrote: is it possible to add checkboxes and radio buttons in the settings
Should be possible. But if a checkbox is not checked no value will be saved, so you should make sure to use a default value in get/return_theme_setting.
2015-12-31, 16:31:18 (This post was last modified: 2015-12-31, 17:14:32 by Arugula.)
Great idea for a plugin! But question/suggestion:
Is it possible to skip the schema? I'd like to offer the user to choose ANY color they want, rather than my small list of color combinations. Example: I'd use @backgroundColor in LESS, and then have a text input field in settings.php that allows user to enter in any 6-digit hex number for it that they wish. They could get that hex number from one of many online color choosing tools. (Although, even better, a color chooser could be incorporated into the settings.php??).
But what function/code would I need to create that text input field in settings.php to allow user to enter a color hex number?
(2015-12-31, 16:31:18)Arugula Wrote: Great idea for a plugin! But question/suggestion:
Is it possible to skip the schema? I'd like to offer the user to choose ANY color they want, rather than my small list of color combinations. Example: I'd use @backgroundColor in LESS, and then have a text input field in settings.php that allows user to enter in any 6-digit hex number for it that they wish. They could get that hex number from one of many online color choosing tools. (Although, even better, a color chooser could be incorporated into the settings.php??).
But what function/code would I need to create that text input field in settings.php to allow user to enter a color hex number?
You can specify any fields in the settings.php.
To combine extra fields specified in settings.php, but not in the *.properties (e.g. provide a template, but let the user specify the link color), use something like this:
Thank you! that was quick. I didn't fully understand your directions at first, but I played around with your code and got it working!
One problem though: on the settings page, when user presses the 'Save Settings' button, the data he'd put in the entry fields disappears. It IS sent to LESS/css, because the edit changes show correctly on the pages. But I'd really like the 'current value' for each of those fields to show in the boxes, even when the user logs back in weeks later, so he or I can see the current value, before attempting to change it.
Is there a change in the code, or new functions that could be made, that would allow us to get/see the 'current existing value' for each of these fields? (So when logging in you'd see: 'Background Color: #D3BD29' or some such. )
Thanks so much for your time!
(2016-01-01, 10:23:45)Arugula Wrote: One problem though: on the settings page, when user presses the 'Save Settings' button, the data he'd put in the entry fields disappears. It IS sent to LESS/css, because the edit changes show correctly on the pages. But I'd really like the 'current value' for each of those fields to show in the boxes, even when the user logs back in weeks later, so he or I can see the current value, before attempting to change it.