title: Wordpress: Add config option to all widget settings
body: <p>In Wordpress, my goal is to be able to give a custom class to every widget that I put in the sidebar.
  Preferably I would like to add this class in the widget settings of each widget. ALSO 3rd party widgets.</p>
  
  <p>I was thinking of changing the classname, because the classname is already passed to the <strong>register_sidebar</strong> function (%2$s):</p>
  
  <pre><code>&lt;?php
  register_sidebar(array('before_widget' =&gt; '&lt;aside id="%1$s" class="widget %2$s blue"&gt;'));
  ?&gt;
  </code></pre>
  
  <p>Ofcourse I shouldn't change WP core code or 3rd party plugins. This means that I need to write a plugin that will hook into the widget configuration process.</p>
  
  <p>I already found out that it's possible to modify all widgets forms, by hooking into action 'in_widget_form':</p>
  
  <pre><code>&lt;?php
  add_action('in_widget_form', 'teaserWidgetAddToForm');
  
  function teaserWidgetAddToForm($widget_instance) {
    ?&gt;
    &lt;label for="&lt;?php echo $widget_instance-&gt;get_field_id('teaser-classname'); ?&gt;"&gt;Custom classname(s):&lt;/label&gt;
    &lt;input type="text" id="&lt;?php echo $widget_instance-&gt;get_field_id('teaser-classname'); ?&gt;" name="&lt;?php echo $widget_instance-&gt;get_field_name('teaser-classname'); ?&gt;"&gt;
    &lt;?php
  }
  ?&gt;
  </code></pre>
  
  <p>This data should be saved by the Widget super class, but how do you retrieve this data (so when opening the widget settings later shows what you filled in earlier)</p>
  
  <p>And, this saved data should be put in the widget instance -how is this done? I guess by using something like:</p>
  
  <pre><code>&lt;?php
  $wp_registered_widgets[&lt;widget_id&gt;]['callback'][0]['widget_options']['classname'] = &lt;chosen_class&gt;;
  ?&gt;
  </code></pre>
  
  <p>So basically I have 2 questions:</p>
  
  <ul>
  <li>Am I using the proper way to address this problem (styling of individual widgets)</li>
  <li>If so, how can I modify a widget instance to save and retrieve additional settings, without having to modify Wordpress or 3rd party Plugin source code.</li>
  </ul>