Skip to content

Instantly share code, notes, and snippets.

@2ndkauboy
Created October 14, 2014 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2ndkauboy/0dcc5eff96bf74a17f06 to your computer and use it in GitHub Desktop.
Save 2ndkauboy/0dcc5eff96bf74a17f06 to your computer and use it in GitHub Desktop.
<?php
/*
* Plugin Name: Text-Widget Highlighted
* Description: Extends the WordPress default text widget by adding a CSS class "widget_text_highlighted" to the container aside HTML tag
* Version: 0.1
* Author: Bernhard Kau
* Author URI: http://kau-boys.de
*/
// only delcare and regsiter the widget after the default widgets have been loaded
add_action( 'widgets_init', 'register_widgets_text_highlighted' );
function register_widgets_text_highlighted() {
class WP_Widget_Text_Highlighted extends WP_Widget_Text {
public function __construct() {
$widget_ops = array( 'classname' => 'widget_text widget_text_highlighted', 'description' => __( 'Arbitrary text or HTML.' ) );
$control_ops = array( 'width' => 400, 'height' => 350 );
parent::WP_Widget( 'text_highlighted', __( 'Text highlighted', 'widget-text-highlighted' ), $widget_ops, $control_ops );
}
}
register_widget( 'WP_Widget_Text_Highlighted' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment