[theme-reviewers] Theme Activation Hook

Towfiq I. tislam100 at gmail.com
Thu Oct 24 09:16:14 UTC 2013


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20131024/039ac764/attachment.html>


More information about the theme-reviewers mailing list