'agentrank_sale', 'description' => __('A Widget to get Agent Sale Transactions from RealtyBaron\'s AgentRank API ', 'agentrank_sale') ); $control_ops = array( 'width' => 200, 'height' => 350, 'id_base' => 'agentrank_sale' ); $this->WP_Widget( 'agentrank_sale', __('AgentRank Sale Transactions', 'agentrank_sale'), $widget_ops, $control_ops ); } function widget( $args, $instance ) { extract( $args ); $title = apply_filters('widget_title', $instance['title'] ); echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; //check options API Key $check_key = get_option('agent_apikey'); //if api key not empty, proceed to do api call //else display error message if(!empty($check_key)){ //use agentrank rest api class to request xml response global $agapi; $xml = $agapi->sidebar_sale_transactions(0); if(!empty($xml)){ //start display widget $html = "