title: Any way to insert content from a widget field into a template?
body: <p>I have a custom widget created where one of the fields is a full telephone number (fulltelephone in the code). It's use is a call to action widget for the sidebar (e.g. enter the number, some text, a button URL, etc.). Is there any way to grab the content from this field (if it's populated in the widget) and add it somewhere to a template? I want to add a phone number to the footer but instead of hardcoding it in the footer, I thought it'd be nice if it could just grab the number already entered in the call to action widget. Is this doable? Thanks.</p>
  
  <p>Here's my widget code:</p>
  
  <pre><code>add_action( 'widgets_init', 'sidebarctawidget' );
  
  function sidebarctawidget() {
      register_widget( 'sidebarctawidget' );
  }
  
  class sidebarctawidget extends WP_Widget {
  
      function sidebarctawidget() {
          $widget_ops = array( 'classname' =&gt; 'sidebarctawidget', 'description' =&gt; __('A widget for the sidebar call to actions ', 'sidebarctawidget') );
  
          $control_ops = array( 'width' =&gt; 300, 'height' =&gt; 350, 'id_base' =&gt; 'sidebarctawidget' );
  
          $this-&gt;WP_Widget( 'sidebarctawidget', __('Sidebar Call to Action', 'sidebarctawidget'), $widget_ops, $control_ops );
      }
  
      function widget( $args, $instance ) {
          extract( $args );
  
          //Our variables from the widget settings.
          $title = apply_filters('widget_title', $instance['title'] );
          $text = $instance['text'];
          $prefix = $instance['prefix'];
          $number = $instance['number'];
          $fullnumber = $instance['fullnumber'];
          $url = $instance['url'];
  
          echo $before_widget;
          echo '&lt;div class="sidebarcta"&gt;';
  
          // Display the title
          if ( $title )
              echo $before_title . $title . $after_title;
  
          //Display the text
          if ( $text )
              printf( '&lt;p class="text"&gt;' . __('%1$s', 'sidebarctawidget') . '&lt;/p&gt;', $text );
  
          //Display the text
          if ( $prefix )
              printf( '&lt;span class="prefix"&gt;' . __('%1$s-', 'sidebarctawidget') . '&lt;/span&gt;', $prefix );
  
          //Display the text
          if ( $number )
              printf( '&lt;span class="number"&gt;' . __('%1$s', 'sidebarctawidget') . '&lt;/span&gt;', $number );
  
          //Display the text
          if ( $fullnumber )
              printf( '&lt;p class="fullnumber"&gt;' . __('(%1$s)', 'sidebarctawidget') . '&lt;/p&gt;', $fullnumber );
  
          //Display the button and URL
          if ( $url )
              printf( '&lt;a class="button" href="%1$s"&gt;' . __('Learn More', 'sidebarctawidget') . '&lt;/a&gt;', $url );
  
          echo '&lt;/div&gt;';
          echo $after_widget;
      }
  
      //Update the widget 
  
      function update( $new_instance, $old_instance ) {
          $instance = $old_instance;
  
          //Strip tags from title and name to remove HTML
          $instance['title'] = strip_tags( $new_instance['title'] );
          $instance['text'] = strip_tags( $new_instance['text'] );
          $instance['prefix'] = strip_tags( $new_instance['prefix'] );
          $instance['number'] = strip_tags( $new_instance['number'] );
          $instance['fullnumber'] = strip_tags( $new_instance['fullnumber'] );
          $instance['url'] = strip_tags( $new_instance['url'] );
  
          return $instance;
      }
  
      function form( $instance ) {
  
          //Set up some default widget settings.
          $defaults = array( 'title' =&gt; __('Get Connected TODAY!', 'sidebarctawidget') );
          $instance = wp_parse_args( (array) $instance, $defaults ); ?&gt;
  
          &lt;p&gt;
              &lt;label for="&lt;?php echo $this-&gt;get_field_id( 'title' ); ?&gt;" style="font-size: 12px; line-height: 16px;"&gt;&lt;?php _e('Title:', 'sidebarctawidget'); ?&gt;&lt;/label&gt;
              &lt;input id="&lt;?php echo $this-&gt;get_field_id( 'title' ); ?&gt;" name="&lt;?php echo $this-&gt;get_field_name( 'title' ); ?&gt;" value="&lt;?php echo $instance['title']; ?&gt;" style="width:97%; border: 1px solid #dfdfdf; -webkit-border-radius: 3px; border-radius: 3px;" /&gt;
          &lt;/p&gt;
  
          &lt;p&gt;
              &lt;label for="&lt;?php echo $this-&gt;get_field_id( 'text' ); ?&gt;" style="font-size: 12px; line-height: 16px;"&gt;&lt;?php _e('Text:', 'sidebarctawidget'); ?&gt;&lt;/label&gt;
              &lt;input id="&lt;?php echo $this-&gt;get_field_id( 'text' ); ?&gt;" name="&lt;?php echo $this-&gt;get_field_name( 'text' ); ?&gt;" value="&lt;?php echo $instance['text']; ?&gt;" style="width:97%; border: 1px solid #dfdfdf; -webkit-border-radius: 3px; border-radius: 3px;" /&gt;
          &lt;/p&gt;
  
          &lt;p style="float: left;"&gt;
              &lt;label for="&lt;?php echo $this-&gt;get_field_id( 'prefix' ); ?&gt;" style="font-size: 12px; line-height: 16px;"&gt;&lt;?php _e('Telephone Prefix:', 'sidebarctawidget'); ?&gt;&lt;/label&gt;
              &lt;input id="&lt;?php echo $this-&gt;get_field_id( 'prefix' ); ?&gt;" name="&lt;?php echo $this-&gt;get_field_name( 'prefix' ); ?&gt;" value="&lt;?php echo $instance['prefix']; ?&gt;" style="width:50%; border: 1px solid #dfdfdf; -webkit-border-radius: 3px; border-radius: 3px; display: block;" /&gt;
          &lt;/p&gt;
  
          &lt;p&gt;
              &lt;label for="&lt;?php echo $this-&gt;get_field_id( 'number' ); ?&gt;" style="font-size: 12px; line-height: 16px;"&gt;&lt;?php _e('Telephone Number:', 'sidebarctawidget'); ?&gt;&lt;/label&gt;
              &lt;input id="&lt;?php echo $this-&gt;get_field_id( 'number' ); ?&gt;" name="&lt;?php echo $this-&gt;get_field_name( 'number' ); ?&gt;" value="&lt;?php echo $instance['number']; ?&gt;" style="width:50%; border: 1px solid #dfdfdf; -webkit-border-radius: 3px; border-radius: 3px;" /&gt;
          &lt;/p&gt;
  
          &lt;p&gt;
              &lt;label for="&lt;?php echo $this-&gt;get_field_id( 'fullnumber' ); ?&gt;" style="font-size: 12px; line-height: 16px;"&gt;&lt;?php _e('Full Number:', 'sidebarctawidget'); ?&gt;&lt;/label&gt;
              &lt;input id="&lt;?php echo $this-&gt;get_field_id( 'fullnumber' ); ?&gt;" name="&lt;?php echo $this-&gt;get_field_name( 'fullnumber' ); ?&gt;" value="&lt;?php echo $instance['fullnumber']; ?&gt;" style="width:97%; border: 1px solid #dfdfdf; -webkit-border-radius: 3px; border-radius: 3px;" /&gt;
          &lt;/p&gt;
  
          &lt;p&gt;
              &lt;label for="&lt;?php echo $this-&gt;get_field_id( 'url' ); ?&gt;" style="font-size: 12px; line-height: 16px;"&gt;&lt;?php _e('Button URL:', 'sidebarctawidget'); ?&gt;&lt;/label&gt;
              &lt;input id="&lt;?php echo $this-&gt;get_field_id( 'url' ); ?&gt;" name="&lt;?php echo $this-&gt;get_field_name( 'url' ); ?&gt;" value="&lt;?php echo $instance['url']; ?&gt;" style="width:97%; border: 1px solid #dfdfdf; -webkit-border-radius: 3px; border-radius: 3px;" /&gt;
          &lt;/p&gt;
  
      &lt;?php
      }
  }
  </code></pre>