__('Primary', 'roots'), 'id' => 'sidebar-primary', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name' => __('News', 'roots'), 'id' => 'sidebar-news', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name' => __('Dev_Center', 'roots'), 'id' => 'sidebar-devcenter', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name' => __('Footer', 'roots'), 'id' => 'sidebar-footer', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); // Widgets register_widget('Roots_Vcard_Widget'); } add_action('widgets_init', 'roots_widgets_init'); include('recentdocswidget.php'); include('recentblogswidget.php'); /** * Example vCard widget */ class Roots_Vcard_Widget extends WP_Widget { private $fields = array( 'title' => 'Title (optional)', 'street_address' => 'Street Address', 'locality' => 'City/Locality', 'region' => 'State/Region', 'postal_code' => 'Zipcode/Postal Code', 'tel' => 'Telephone', 'email' => 'Email' ); function __construct() { $widget_ops = array('classname' => 'widget_roots_vcard', 'description' => __('Use this widget to add a vCard', 'roots')); $this->WP_Widget('widget_roots_vcard', __('Roots: vCard', 'roots'), $widget_ops); $this->alt_option_name = 'widget_roots_vcard'; add_action('save_post', array(&$this, 'flush_widget_cache')); add_action('deleted_post', array(&$this, 'flush_widget_cache')); add_action('switch_theme', array(&$this, 'flush_widget_cache')); } function widget($args, $instance) { $cache = wp_cache_get('widget_roots_vcard', 'widget'); if (!is_array($cache)) { $cache = array(); } if (!isset($args['widget_id'])) { $args['widget_id'] = null; } if (isset($cache[$args['widget_id']])) { echo $cache[$args['widget_id']]; return; } ob_start(); extract($args, EXTR_SKIP); $title = apply_filters('widget_title', empty($instance['title']) ? __('vCard', 'roots') : $instance['title'], $instance, $this->id_base); foreach($this->fields as $name => $label) { if (!isset($instance[$name])) { $instance[$name] = ''; } } echo $before_widget; if ($title) { echo $before_title, $title, $after_title; } ?>



,

flush_widget_cache(); $alloptions = wp_cache_get('alloptions', 'options'); if (isset($alloptions['widget_roots_vcard'])) { delete_option('widget_roots_vcard'); } return $instance; } function flush_widget_cache() { wp_cache_delete('widget_roots_vcard', 'widget'); } function form($instance) { foreach($this->fields as $name => $label) { ${$name} = isset($instance[$name]) ? esc_attr($instance[$name]) : ''; ?>