'example', 'description' => __('A widget to display 2StateReviews user votes.', 'example') ); $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'example-widget' ); $this->WP_Widget( 'example-widget', __('2State Widget', 'example'), $widget_ops, $control_ops ); } function widget( $args, $instance ) { extract( $args ); $title = apply_filters('widget_title', $instance['title'] ); $name = $instance['name']; $items = $instance['items']; echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; $json = file_get_contents($GLOBALS['twostate_url']."/api/latestuservotes/".$name."/".$items); $array = json_decode($json,TRUE); for ($i=0; $i" . "" . "" . $vote . "
"; endfor; echo "All my votes " . "here."; echo $after_widget; } function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = strip_tags( $new_instance['title'] ); $instance['name'] = strip_tags( $new_instance['name'] ); $instance['items'] = strip_tags( $new_instance['items'] ); return $instance; } function form( $instance ) { $defaults = array( 'title' => __('Movie Reviews', 'example'), 'name' => __('2', 'example'), 'items' => __('3','example') ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>