Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: widget_text

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
393      function __construct() {
394           $widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML'));
395           $control_ops = array('width' => 400, 'height' => 350);
396           parent::__construct('text', __('Text'), $widget_ops, $control_ops);
397      }
398
399      function widget( $args, $instance ) {
400           extract($args);
401           $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
402           $text = apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance );
403           echo $before_widget;
404           if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
405                <div class="textwidget"><?php echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?></div>
406           <?php
407           echo $after_widget;
408      }
409
410      function update( $new_instance, $old_instance ) {
411           $instance = $old_instance;