Welcome, visitor! Log in
 

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.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

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
371      function WP_Widget_Text() {
372           $widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML'));
373           $control_ops = array('width' => 400, 'height' => 350);
374           $this->WP_Widget('text', __('Text'), $widget_ops, $control_ops);
375      }
376
377      function widget( $args, $instance ) {
378           extract($args);
379           $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);
380           $text = apply_filters( 'widget_text', $instance['text'] );
381           echo $before_widget;
382           if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
383                <div class="textwidget"><?php echo $instance['filter'] ? wpautop($text) : $text; ?></div>
384           <?php
385           echo $after_widget;
386      }
387
388      function update( $new_instance, $old_instance ) {
389           $instance = $old_instance;