'Embed Servicemagic forms or lists into the sidebar.' );//'classname' => 'example', /* Widget control settings. */ //$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'example-widget' ); /* Create the widget. */ parent::__construct( 'sm-widget', 'Servicemagic', $widget_ops ); } function widget($args, $instance) { extract( $args ); //get site sitewide defaults $sm_display_defaults = get_option("sm_display_defaults"); new sm_wp_log("Showing category list for category_id \"{$instance['category_id']}\" widget"); //load the api $api = sm_api_factory(); //get the list try { $category_list = $api->sr->category->activities->get(array('category'=>$instance['category_id'])); } catch(Exception $e){ return ""; } $category_list->set_parameter("sm_display_defaults", $sm_display_defaults); echo $before_widget; echo $before_title; echo $instance['sm_title']; echo $after_title; echo $category_list->render(); echo $after_widget; } function form( $instance ) { /* Set up some default widget settings. */ $defaults = array( 'category_id' => "" , 'sm_title' => "What are you building?"); $instance = wp_parse_args( (array) $instance, $defaults ); ?>