Skip to content

Instantly share code, notes, and snippets.

@lswilson
Created January 29, 2013 03:13
Show Gist options
  • Save lswilson/4661485 to your computer and use it in GitHub Desktop.
Save lswilson/4661485 to your computer and use it in GitHub Desktop.
The whole darned thing.
// swap out the widget-title markup
class Drad_Sidebar_Markup extends SB_Sidebars {
// Activate all sidebars, override this to customize sidebar markup
function widgets_init() {
// If there aren't any sidebars, skip the rest
if ( !$this->sidebars || empty($this->sidebars) ) return;
// Otherwise, lets register all of them
foreach ( $this->sidebars as $id => $info ) {
register_sidebar(array(
'name' => esc_html( $info['name'] ),
'id' => $id,
'description' => esc_html( $info['description'] ),
'editable' => intval( $info['editable'] ),
'before_widget' => "\n\t\t\t" . '<li id="%1$s" class="widget %2$s">',
'after_widget' => "\n\t\t\t</li>\n",
'before_title' => "\n\t\t\t\t". '<h3 class="widget-title">',
'after_title' => '</h3>'."\n"
));
}
}
}
new Drad_Sidebar_Markup;
// Here we add a <span>...</span> around the first word in the widget title, because: red & black
function drad_widget_title($title) {
$title = preg_replace('/(^[A-z0-9_]+)\s/i', '<span>$1</span> ', $title);
return $title;
}
add_filter('widget_title', 'drad_widget_title');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment