[theme-reviewers] Theme Activation Hook

Stanko Metodiev stanko at metodiew.com
Thu Oct 24 09:20:37 UTC 2013


You always can check if you the option exists. If not, you can have default
options

More info here:
http://codex.wordpress.org/Function_Reference/get_option


On Thu, Oct 24, 2013 at 12:16 PM, Towfiq I. <tislam100 at gmail.com> wrote:

> because upon activating the theme, the my_theme_options table is not
> created inside wp_options table.
>
>
> On Thu, Oct 24, 2013 at 2:35 PM, Konstantin Kovshenin <kovshenin at gmail.com
> > wrote:
>
>> Why are you trying to write the default options to the database? You can
>> just use $options = get_option( 'your_theme_options', $defaults ); and
>> update them only if they've changed on your options page. I would also
>> suggest looking into theme mods and not options:
>> https://codex.wordpress.org/Function_Reference/get_theme_mod
>>
>>
>> On Thu, Oct 24, 2013 at 12:30 PM, Towfiq I. <tislam100 at gmail.com> wrote:
>>
>>> Are we allowed to use:
>>>
>>> *if (is_admin() && isset($_GET['activated'] ) && $pagenow ==
>>> "themes.php" ) {**}*
>>> *
>>> *
>>> *
>>> *
>>> *example:*
>>> *---------------------
>>> *if (is_admin() && isset($_GET['activated'] ) && $pagenow ==
>>> "themes.php" ) {
>>>   $option_default_values = array(
>>> "block1_text_id" => "Lorem Ipsum",
>>> "block1_textarea_id" => "Lorem Ipsum blah blah blah");
>>>
>>> update_option('theme_options', $option_default_values);
>>> }
>>> --------------------------
>>>
>>> if we are not, what should we use instead?
>>> after_setup_theme doesnt work btw.
>>>
>>> or should we use after_switch_theme?
>>>
>>> Thanks
>>> --
>>> Towfiq I.
>>>
>>> _______________________________________________
>>> theme-reviewers mailing list
>>> theme-reviewers at lists.wordpress.org
>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>
>>>
>>
>>
>> --
>> Konstantin
>>
>> _______________________________________________
>> theme-reviewers mailing list
>> theme-reviewers at lists.wordpress.org
>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>
>>
>
>
> --
> Towfiq I.
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>


-- 
Stanko Metodiev,
WordPress Developer @metodiew
http://metodiew.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20131024/8b486321/attachment.html>


More information about the theme-reviewers mailing list