'dribbble_widget', 'description' => 'Images from your dribbble account.' ); $control_ops = array('width' => 80, 'height' => 80); parent::WP_Widget(false, 'Themewaves dribbble', $widget_ops, $control_ops); } function form($instance) { $instance = wp_parse_args((array) $instance, array('dribbble_title' => '')); $dribbble_title = isset($instance['dribbble_title']) ? strip_tags($instance['dribbble_title']) : ''; $dribbble_userid = isset($instance['dribbble_userid']) ? strip_tags($instance['dribbble_userid']) : ''; $dribbble_num = isset($instance['dribbble_num']) ? strip_tags($instance['dribbble_num']) : ''; ?>



Find ID http://dribbble.com/

'; $shots=false; $response = wp_remote_get( 'http://api.dribbble.com/players/' . $dribbble_userid . '/shots/?per_page='.$dribbble_num ); if( !is_wp_error( $response ) ){ $xml = wp_remote_retrieve_body( $response ); if( !is_wp_error( $xml ) ){ if( $response['headers']['status'] == 200 ) { $json = json_decode( $xml ); $shots = $json->shots; } } } if( $shots ) { foreach( $shots as $shot ){ echo ''; echo '' . $shot->title . ''; echo ''; } } else { echo __('Error', 'themewaves'); } echo ''; echo $after_widget; } } add_action('widgets_init', create_function('', 'return register_widget("dribbblewidget");')); ?>