I've been following this great tutorial () and now I have set the Theme customizer.  As far as I understand the settings I assign in the customizer are saved in the database every time the user "saves" in the theme customizer page. Which means that after activating the theme for the first time and before going to the customizer, the settings are not saved.  My question is, How can I save the settings just after the user activates the theme? (the $wp_customize->add_setting default value)  Pd. I've been looking for some time, and got this hooks: "after_setup_theme", "switch_theme", but I cant figure out how to do it.  Edit: The "duplicate question" answers how to provide a fallback when there is no setting available. Although it might be a workaround, I would like to know how to save (register) the settings when activating the theme.
I am still learning settings API so please forgive my noob question. I have three fields: a checkbox, colorpicker and text field (they are working), but I would like to do this: when the theme is installed add "checked" state to my checkbox but allow user to "unchecked" it ,and if empty add default color to my colorpicker... I have no idea how to do this so please help me!  My code looks like this now (thanks to @Chip Bennett! ) :  &lt;?php add_action('admin_menu','create_theme_options_page'); function create_theme_options_page(){ add_options_page('Theme Options','Theme Options','administrator',__FILE__,'build_options_page'); }    function build_options_page(){    ?&gt;    &lt;div id="theme-options-wrap"&gt;    &lt;div style="float:left;margin-top:19px;position:absolute;" class="icon32" id="icon-tools"&gt;&lt;br/&gt;&lt;/div&gt;    &lt;h2&gt;My options page&lt;/h2&gt;    &lt;form method="post" action="options.php"&gt;    &lt;?php settings_fields('plugin_options');?&gt;    &lt;?php do_settings_sections(__FILE__); ?&gt;    &lt;p class="submit"&gt;    &lt;input name="Submit" type="submit" class="button-primary" value="&lt;?php esc_attr_e('Save changes');?&gt;"/&gt;    &lt;/p&gt;    &lt;/form&gt;    &lt;/div&gt;    &lt;?php    }       add_action('admin_init','register_and_build_fields');      function register_and_build_fields(){      register_setting('plugin_options','plugin_options','validate_setting');      add_settings_section('main_section','&lt;br/&gt;&lt;br/&gt;Main Settings','section_cb',__FILE__);      add_settings_field('banner_heading','Banner Heading:','banner_heading_setting',__FILE__,'main_section');      add_settings_field('display_sidebar','Display Sidebar:','display_sidebar_setting',__FILE__,'main_section');      add_settings_field('display_colorpicker','Display Colorpicker:','display_colorpicker_setting',__FILE__,'main_section');      }        //Install Iris colorpicker        add_action( 'admin_enqueue_scripts', 'mw_enqueue_color_picker' );        function mw_enqueue_color_picker( $hook_suffix ) {        // first check that $hook_suffix is appropriate for your admin page        wp_enqueue_style( 'wp-color-picker' );        wp_enqueue_script( 'my-script-handle', get_template_directory_uri() . '/js/my-script.js', array( 'wp-color-picker' ), false, true );        }           //Colorpicker          //Now how to add a default color on theme install?          function display_colorpicker_setting(){          $options = get_option('plugin_options');          echo"&lt;input type='text' id='color1' name='plugin_options[display_colorpicker]' value='{$options['display_colorpicker']}'/&gt;";          }            //Sidebar checkbox           //Now how to add a default state "checked" on theme install?           function display_sidebar_setting(){           $options = get_option('plugin_options');           echo "&lt;input type='checkbox' name='plugin_options[display_sidebar]' {$options['display_sidebar']} id='display_sidebar' /&gt;";           }              //Banner Heading             function banner_heading_setting(){             $options = get_option('plugin_options');             echo "&lt;input name='plugin_options[banner_heading]' type='text' value='{$options['banner_heading']}'/&gt;";             }               //Validate our settings here               function validate_setting($plugin_options){                  return $plugin_options;               }                 function section_cb(){                } ?&gt;
In a P.I.D., if $a^m = b^m$ and $a^n = b^n$ for $m, n \in \mathbb{N}$ with $\gcd(m,n) = 1$, then $a=b$ Let $R$ be a principal ideal domain, and $a, b \in R$ with $a^m = b^m$ and $a^n = b^n$ for $m, n \in \mathbb{N}$, and $\gcd(m, n) = 1$. I now want to show that we then already have $a = b$.   I think the statement is easily seen to be true if $a = 0$ (or $b = 0$), since if $a = 0$ and $a^m = b^m$, then $a = b$ since $R$ doesn't contain any nontrivial zero divisors, so $b ≠ 0$ already implicates $b^m = b \cdot b^{m-1} ≠ 0$.  I don't really know how to prove the statement for the general case, where I can't directly apply the fact that $R$ doesn't have any zero divisors except $0$. I most likely have to use the fact at some point that $gcd(a, b) = 1$, but I'm not sure how. Should I declare chocolate as "food" when entering the US? It is being customary we bring a few authentic Russian chocolate bars/sweets to the US but we are always struggling whether we should check that "food" checkbox in the "Customs Declaration" form?  It is under the following entry in the form (yeah, together with insects, right):     I am (We are) bringing:      fruits, vegetables, plants, seeds, food, insects   I've been always checking it but that just gets us into more lines and triggers extra questions after getting to the baggage check. Is it supposed to be a HTML or an HTML Many people (at least in Germany) think that Italians add olive oil to the boiling water for spaghetti. However, Italians tend to tell the opposite (from my experience).  So, can you please state objective reasons for or against adding olive oil to the boiling water for spaghetti? Strange arrow mark with TikZ edge and anchors. When I draw an edge between two nodes with anchors and globally set option [-&gt;], I get an additional arrow tip symbol at the beginning of the last edge in the path. For example in  \documentclass{article} \usepackage{tikz}  \begin{document} \begin{tikzpicture}     \node (A) at (0,0) {$A$};     \node (B) at (1,0) {$B$};      \draw[-&gt;] (A.north east) edge (B.north west);      \draw (A.south east) edge[-&gt;] (B.south west); \end{tikzpicture} \end{document}   the first \draw command produces incorrect output, while the second produces correct output:    Am I doing something wrong, or is this a bug in TikZ? Casting two cantrips, both modified by metamagic? Can you cast one cantrip, modifying it with "Twinned Spell" (Fire Bolt) to target 2 creatures, and then cast another cantrip as a Bonus Action (Fire Bolt), using "Quickened Spell" to target one of the previous creatures or another creature? Complex numbers equation: $z^4 = -16$ Find the highest order bit in C If $[G' : G'']\leq p^2$, then $G'$ is abelian. I know that an easy to handle formula for the CDF of a normal distribution is somewhat missing, due to the complicated error function in it.  However, I wonder if there is a a nice formula for $N(c_{-} \leq x &lt; c_{+}| \mu, \sigma^2)$. Or what the "state of the art" approximation for this problem might be. I read this book once when I was in middle school. A girl solves a murder or a mystery on a spaceship. It was a thin paperback books.   All I can remember is that there was an alien, and there was a movie star or actress or famous makeup artist on the ship traveling with another woman. By the end of the book the murderer was the woman the actress was traveling with who forced her to use her makeup skills to disguise her, and she was really some kind of alien. The ending I got is :      the genocide   When I reset my file, my past choices still take effect. I want to start a clean run.  I don't want to buy the game again, what do I do? Unexpected AdjacencyMatrix output I try to understand why for a connected Lie group $G$ the first fundamental group $\pi_1(G)$ is abelian, and mainly why the second fundamental group is trivial $\pi_2(G)=0$?  Thanks for anyone who give me references for a 'simple proof' of these results I have the following code that will remove lines with the pattern banana and 2 lines after it:  sed '/banana/I,+2 d' file   So far, so good! But I need it to remove 2 lines before banana, but I can't get it with a “minus sign” or whatever (similar to what grep -v -B2 banana file should do but doesn't):  teresaejunior@localhost ~ &gt; LC_ALL=C sed '-2,/banana/I d' file sed: invalid option -- '2' teresaejunior@localhost ~ &gt; LC_ALL=C sed '/banana/I,-2 d' file sed: -e expression #1, char 16: unexpected `,' teresaejunior@localhost ~ &gt; LC_ALL=C sed '/banana/I,2- d' file sed: -e expression #1, char 17: unknown command: `-' "He added" vs. "Did he add" (inversion after negative adverb) I've just started to learn about the tensor product and I want to show: $$(\mathbb{Z}/m\mathbb{Z}) \otimes_\mathbb{Z} (\mathbb{Z} / n \mathbb{Z}) \cong \mathbb{Z}/ \gcd(m,n)\mathbb{Z}.$$  Can you tell me if my proof is right:  $\mathbb{Z}/m\mathbb{Z}$ and $\mathbb{Z} / n \mathbb{Z}$ are both finite free $\mathbb{Z}$-modules with the basis consisting of one single element $\{ 1 \}$. So $(\mathbb{Z}/m\mathbb{Z}) \otimes_\mathbb{Z} (\mathbb{Z} / n \mathbb{Z})$ has the basis $\{ 1 \otimes 1 \}$.  Therefore, any element in $(\mathbb{Z}/m\mathbb{Z}) \otimes_\mathbb{Z} (\mathbb{Z} / n \mathbb{Z})$  is of the form $(ab) 1 \otimes 1$ and any element in $\mathbb{Z}/ \gcd(m,n)\mathbb{Z}$ is of the form $k 1 = k$ where $k \in \{ 0, \dots , \gcd(n,m) \}$.  I would like to construct an isomorphism that maps $ab$ to some $k$. Let this map be $ab (1 \otimes 1) \mapsto ab \bmod \gcd(n,m)$.  This is a homomorphism between modules: it maps $0$ to $0$ because it maps the empty sum to the empty sum. It also fulfills $f(a + b) = f(a) + f(b)$ because there is only one element, $a = 1$.   It is surjective. So all I need to show is that it is injective. But that is clear too because if $ab \equiv 0 \bmod \gcd(m,n)$  then both $a \equiv 0 \bmod n$ and $b \equiv 0 \bmod m$ so the kernel is trivial.  Many thanks for your help!! How to access the grub boot menu in order to generate bootchart? I am running Ubuntu Gnome 15.04, and I want to generate a bootchart to help me diagnose some system problems. However in  it says:    So how do I access the grub boot menu in order to append this text? And just to be clear, how should the line look once I have appended the necessary text? Also, is grub already installed for I don't appear to have either or these packages: grub or grub2?    OS Information:  No LSB modules are available. Distributor ID: Ubuntu Description:    Ubuntu 15.04 Release:    15.04 Codename:   vivid Does anyone know of a nice (and preferably free) way to integrate Prolog and C#?  Im looking to create a Prolog dll or similar to call from my managed code, and retrieve an answer once all the processing has been complete. Im looking for it to be predominantly one sided (c# calls Prolog).  I have seen  which talks about Prologs real world usage but I was wondering if anyone had either any experience with c# &amp; Prolog? or a nice tutorial/article? "OpenID 2.0 for Google Accounts is going away"; will this affect Stack Exchange?