[theme-reviewers] Note to theme reviewers about settings inthemes

Otto otto at ottodestruct.com
Sun Jun 12 22:04:58 UTC 2011


Several ways to solve that, the easiest of which is simply to use an
isset() before trying to use the variables.

But basically, I just mean it's a bad idea to set defaults into the
database, ever. This would be a better approach:

$foo = get_theme_mod('my_setting','default_value');

That gets you the default_value if my_setting isn't set.

-Otto



On Sun, Jun 12, 2011 at 4:57 PM, Emil Uzelac <emil at themeid.com> wrote:
> I see and understood. Thanks :)
>
> Weird thing about this is when defaults are not set and activated in Theme
> Options, there are some bugs, i.e.
> Other warnings: 2
> -- Debug: Undefined index: home_subheadline on line 133 of
> /wp-content/themes/shell/includes/theme-options.php
> -- Debug: Undefined index: contact_email on line 238 of
> /wp-content/themes/shell/includes/theme-options.php
> And once "Save Options" they go away.
> I am seeing this with Coraline as well. But when defaults are set this
> "Undefined index" is not present.
> Emil
>


More information about the theme-reviewers mailing list