[theme-reviewers] Note to theme reviewers about settings inthemes
Syahir Hakim
khairulsyahir at gmail.com
Sun Jun 12 21:54:40 UTC 2011
Agreed. I think it's more of something like this:
$graphene_defaults = array( /* Array of the theme's default settings */ );
$graphene_settings = array_merge($graphene_defaults,
get_option('graphene_settings', array()));
--
Regards,
Syahir Hakim
Contact:
http://www.khairul-syahir.com
+6421 0333 649
On 13/6/2011 9:44 AM, Philip M. Hofer (Frumph) wrote:
> pretty sure that’s what otto wants to avoid, since on activation that
> will create those update_options in the database, he wants to use the
> predefined options at all times “until” someone hits the save in the
> theme options. I’m assuming because people switching themes all the
> time to check them out to see if they want to use a theme – don’t want
> to overload the database with a bunch of entries for themes not in use
> (at least that’s my reasoning why it would be important)
> *From:* Emil Uzelac <mailto:emil at themeid.com>
> *Sent:* Sunday, June 12, 2011 2:41 PM
> *To:* theme-reviewers at lists.wordpress.org
> <mailto:theme-reviewers at lists.wordpress.org>
> *Subject:* Re: [theme-reviewers] Note to theme reviewers about
> settings inthemes
> Or like in Coraline Theme?
>
> /**
> * Set default options
> */
> function coraline_default_options() {
> $options = get_option( 'coraline_theme_options' );
> if ( ! isset( $options['color_scheme'] ) ) {
> $options['color_scheme'] = 'light';
> update_option( 'coraline_theme_options', $options );
> }
> if ( ! isset( $options['theme_layout'] ) ) {
> $options['theme_layout'] = 'content-sidebar';
> update_option( 'coraline_theme_options', $options );
> }
> }
> add_action( 'init', 'coraline_default_options' );
>
>
>
>
> ----
> *Emil Uzelac* | ThemeID | T: 224-444-0006 | Twitter: @EmilUzelac | E:
> emil at themeid.com <mailto:emil at themeid.com> | http://themeid.com
> <http://themeid.com/>
> Make everything as simple as possible, but not simpler. - Albert Einstein
>
>
>
> On Sun, Jun 12, 2011 at 4:35 PM, Philip M. Hofer (Frumph)
> <philip at frumph.net <mailto:philip at frumph.net>> wrote:
>
> I am not having an issue with the that being a 'best practice'
> rule., maybe not a requirement [at this time] but definitely best
> practice.
>
> Are you saying this?
>
> $default_theme_options = array('someoption' => true,
> 'someotheroption' => false);
> // if 'theme_options' returns false use all of the parameters from
> $default_theme_options
> $theme_options = get_option('theme_options', $default_theme_options);
>
>
>
>
> -----Original Message----- From: Otto
> Sent: Sunday, June 12, 2011 1:26 PM
> To: WP Theme Reviewers Mailing List
> Subject: [theme-reviewers] Note to theme reviewers about settings
> in themes
>
>
> This is just a note about a rule that I think should be added to the
> theme review process:
>
> - Themes should not do anything to the database merely by virtue of
> being activated.
>
> By that, I mean that having a theme check for a setting, like
> get_option or get_theme_mod and then calling set_option or
> set_theme_mod to set it to some default is wrong.
>
> Both get_option and get_theme_mod accept a second parameter of a
> default setting. If I call get_option('whatever',123) and there is no
> whatever option, then that will return 123.
>
> Use the defaults properly. Don't set them just because they're not
> there.
>
> -Otto
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> <mailto:theme-reviewers at lists.wordpress.org>
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> <mailto:theme-reviewers at lists.wordpress.org>
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
> ------------------------------------------------------------------------
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
> _______________________________________________
> 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