get_theme_option failing to register

I've used the following theme configuration code a few times, but for some reason, it is not working this time around:

in config.ini

; About Text
about.type = "textarea"
about.options.label = "About Text"
about.options.description = "Enter a description of your site. This text will be used on the mobile web homepage."
about.options.value = ""

in custom.php:

function mh_about($text=null){
    if (!$text) {
        $text =
        get_theme_option('About Text') ?
        get_theme_option('About Text') :
    return $text;

in index.php:
<?php echo mh_about();?>

Basically, it seems like $text is returning a null/false value, even though it is set in the theme options.

Are there any server-related reasons this might happen or am I just missing something obvious.

Thanks - E

Also, bypassing the custom function, this also returns empty/null/false:

<?php echo get_theme_option('About Text');?>

You can use var_dump instead of echo to see more exactly what kind of return value you're getting here.

So, the value does persist when you go to edit the theme configuration again?

Returns NULL.

Oddly, the value does indeed persist in theme configuration. I even double-checked to make sure I'm not editing the wrong theme.

Hmmm. Okay, I see what's happening here. I was using get_theme_option('About Text') when I needed to be using get_theme_option('about'). This is not the usual behavior if I recall?

Yes, that's not the usual behavior.

Do the configuration options for the "normal" themes all work correctly? The theme options should always be available by the label name, not the "internal" one.

On the configuration form, does the label "About Text" show up correctly?

Looking at Seasons theme, it sort of uses both:


; Style Sheet
style_sheet.type = "select"
style_sheet.options.label = "Style Sheet"
style_sheet.options.description = "Choose a style sheet"
style_sheet.options.multiOptions.spring = "Spring"
style_sheet.options.multiOptions.summer = "Summer"
style_sheet.options.multiOptions.autumn = "Autumn"
style_sheet.options.multiOptions.winter = "Winter"
style_sheet.options.value = "winter"

logo.type = "file"
logo.options.label = "Logo File"
logo.options.description = "Choose a logo file."
logo.options.validators.count.validator = "Count"
logo.options.validators.count.options.max = "1"

These are called in custom.php using get_theme_option('Style Sheet') and get_theme_option('Logo') respectively.

Note how the logo is not strictly using either convention ("Logo" is capitalized and missing the "File" part of the label)

But yes, the labels appear as normal in the config screen for all themes.

I think we've been unclear about how the names work.

It is the "internal" name that matters, the one before the dots, it's just that we pre-process the string you pass to get_theme_option, so you can use capital letters and spaces instead of underscores and it will still match.

This can get confusing because the naming conventions can make it appear like the Label is the important part, but it is really the "internal" name that matters when getting and setting theme options.

I see.

I wonder then, why not just use the internal name? Seems just as easy and more efficient.

I guess the reason this never came up before is that my labels and internal names had always been the same after processing.

Would either method be supported in the long-term or should I stick to the documented way of using caps and spaces?

Caps and spaces, lowercase and spaces, and lowercase and underscores should all be supported now and in the future.

Which you want to use is really personal preference, more or less.