Formatting

This commit is contained in:
Scott Walkinshaw
2012-09-19 14:46:06 -04:00
parent c707448a72
commit a54850cd44
2 changed files with 18 additions and 14 deletions

View File

@@ -237,16 +237,16 @@ function roots_caption($output, $attr, $content) {
} }
$defaults = array( $defaults = array(
'id' => '', 'id' => '',
'align' => 'alignnone', 'align' => 'alignnone',
'width' => '', 'width' => '',
'caption' => '' 'caption' => ''
); );
$attr = shortcode_atts($defaults, $attr); $attr = shortcode_atts($defaults, $attr);
// If the width is less than 1 or there is no caption, return the content wrapped between the [caption] tags // If the width is less than 1 or there is no caption, return the content wrapped between the [caption] tags
if (1 > $attr['width'] || empty($attr['caption'])) { if ($attr['width'] < 1 || empty($attr['caption'])) {
return $content; return $content;
} }

View File

@@ -3,20 +3,21 @@
function roots_widgets_init() { function roots_widgets_init() {
// Register widgetized areas // Register widgetized areas
register_sidebar(array( register_sidebar(array(
'name' => __('Primary Sidebar', 'roots'), 'name' => __('Primary Sidebar', 'roots'),
'id' => 'sidebar-primary', 'id' => 'sidebar-primary',
'before_widget' => '<section id="%1$s" class="widget %2$s"><div class="widget-inner">', 'before_widget' => '<section id="%1$s" class="widget %2$s"><div class="widget-inner">',
'after_widget' => '</div></section>', 'after_widget' => '</div></section>',
'before_title' => '<h3>', 'before_title' => '<h3>',
'after_title' => '</h3>', 'after_title' => '</h3>',
)); ));
register_sidebar(array( register_sidebar(array(
'name' => __('Footer', 'roots'), 'name' => __('Footer', 'roots'),
'id' => 'sidebar-footer', 'id' => 'sidebar-footer',
'before_widget' => '<section id="%1$s" class="widget %2$s"><div class="widget-inner">', 'before_widget' => '<section id="%1$s" class="widget %2$s"><div class="widget-inner">',
'after_widget' => '</div></section>', 'after_widget' => '</div></section>',
'before_title' => '<h3>', 'before_title' => '<h3>',
'after_title' => '</h3>', 'after_title' => '</h3>',
)); ));
// Register widgets // Register widgets
@@ -28,6 +29,7 @@ add_action('widgets_init', 'roots_widgets_init');
class Roots_Vcard_Widget extends WP_Widget { class Roots_Vcard_Widget extends WP_Widget {
function Roots_Vcard_Widget() { function Roots_Vcard_Widget() {
$widget_ops = array('classname' => 'widget_roots_vcard', 'description' => __('Use this widget to add a vCard', 'roots')); $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->WP_Widget('widget_roots_vcard', __('Roots: vCard', 'roots'), $widget_ops);
$this->alt_option_name = 'widget_roots_vcard'; $this->alt_option_name = 'widget_roots_vcard';
@@ -64,6 +66,7 @@ class Roots_Vcard_Widget extends WP_Widget {
if (!isset($instance['email'])) { $instance['email'] = ''; } if (!isset($instance['email'])) { $instance['email'] = ''; }
echo $before_widget; echo $before_widget;
if ($title) { if ($title) {
echo $before_title; echo $before_title;
echo $title; echo $title;
@@ -100,6 +103,7 @@ class Roots_Vcard_Widget extends WP_Widget {
$this->flush_widget_cache(); $this->flush_widget_cache();
$alloptions = wp_cache_get('alloptions', 'options'); $alloptions = wp_cache_get('alloptions', 'options');
if (isset($alloptions['widget_roots_vcard'])) { if (isset($alloptions['widget_roots_vcard'])) {
delete_option('widget_roots_vcard'); delete_option('widget_roots_vcard');
} }