Created
October 14, 2014 18:36
-
-
Save 2ndkauboy/0dcc5eff96bf74a17f06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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