'poker_widget', 'description' => __( "Example widget demoing WordPress 2.8 widget API") ); $control_ops = array('width' => 300, 'height' => 300); $this->WP_Widget('pokerwidget', __('Poker Widget'), $widget_ops, $control_ops); } /** * Displays the Widget * */ function widget($args, $instance){ # Widget internal parameters $feeds_url = 'http://feeds.incomate.com/?type=7499&asf=aptc:23x1;configID:Full&geo=true'; $default_width = '270px'; $default_height; // Set a value here if you wanna ensure a minimum height $bottom_html = '

poker widget

'; // Set HTML content here extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? ' ' : $instance['title']); $width = empty($instance['width']) ? $default_width : $instance['width']; $height = empty($instance['height']) ? $default_height : $instance['height']; # Before the widget echo $before_widget; # The title if ( $title ) echo $before_title . $title . $after_title; # Make the HTML of the widget echo ''; echo $bottom_html; # After the widget echo $after_widget; } /** * Saves the widgets settings. * */ function update($new_instance, $old_instance){ $instance = $old_instance; $instance['title'] = strip_tags(stripslashes($new_instance['title'])); $instance['width'] = strip_tags(stripslashes($new_instance['width'])); $instance['height'] = strip_tags(stripslashes($new_instance['height'])); return $instance; } /** * Creates the edit form for the widget. * */ function form($instance){ //Defaults $instance = wp_parse_args( (array) $instance, array('title'=>'Poker Widget', 'width'=>'170px', 'height'=>'150px') ); $title = htmlspecialchars($instance['title']); $width = htmlspecialchars($instance['width']); $height = htmlspecialchars($instance['height']); # Output the options echo '

'; # Text line 1 echo '

'; # Text line 2 echo '

'; } }// END class /** * Register Hello World widget. * * Calls 'widgets_init' action after the Hello World widget has been registered. */ function PokerWidgetInit() { register_widget('PokerWidget'); } add_action('widgets_init', 'PokerWidgetInit'); ?>