I'm working on a custom theme with message field(textfield) in custom advanced theme setting.
In "theme-settings.php", I added a "textfield" for "message" field
<?php
function MYTHEME_form_system_theme_settings_alter(&$form, $form_state) {
$form['message_value'] = array(
'#type' => 'textfield',
'#size' => 12,
'#maxlength' => 100,
'#default_value' => theme_get_setting('message_value'),
'#description' => t('Some text here'),
);
}
?>
In "template.php", I added "theme_get_setting"
<?php
function MYTHEME_preprocess_page(&$vars) {
$message = theme_get_setting('message_value');
}
And in my "page.tpl.php", I render the "message" if it is not empty
<?php if(!empty($message)) echo $message; ?>
The problem is, it does not render anything and has no error.
It works if I put the theme_get_setting in page.tpl.php
<?php $message = theme_get_setting('message_value'); ?>
How to make it work if I want to put that in "template.php"?