[theme-reviewers] Note to theme reviewers about settingsinthemes

Philip M. Hofer (Frumph) philip at frumph.net
Sun Jun 12 22:08:17 UTC 2011


There are a ton of us that do not use get_theme_mod and probably never will; 
Myself included.  s  o  if you could answer the other questions if 
get_option()'s second parameter is fired on false return that'd be great.

- Phil


-----Original Message----- 
From: Otto
Sent: Sunday, June 12, 2011 3:04 PM
To: theme-reviewers at lists.wordpress.org
Subject: Re: [theme-reviewers] Note to theme reviewers about 
settingsinthemes

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
>
_______________________________________________
theme-reviewers mailing list
theme-reviewers at lists.wordpress.org
http://lists.wordpress.org/mailman/listinfo/theme-reviewers 



More information about the theme-reviewers mailing list