'contact-widget', 'description' => __('Display contact info of author profile on post or pages and site / theme contact on others', 'bj')); /* Widget control settings. */ //$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'example-widget' ); $control_ops = array( 'width' => '100%', 'height' => '100%', 'id_base' => 'bj-contact-widget'); /* Create the widget. */ $this->WP_Widget('bj-contact-widget', __('Contact Box', 'bj'), $widget_ops, $control_ops); } /** * Now to display the widget on the screen. */ function widget($args, $instance) { extract($args); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', $instance['title']); //$show_user = $instance['user']; //$show_sex = isset( $instance['show_sex'] ) ? $instance['show_sex'] : false; /* Before widget (defined by themes). */ echo $before_widget; echo "
"; /* Display the widget title if one was input (before and after defined by themes). */ if ($title) echo $before_title . $title . $after_title; if (is_single() or is_page()): BJ::contact_author(); else : BJ::contact_org(); endif; /* After widget (defined by themes). */ echo "
"; echo $after_widget; } /** * Update the widget settings. */ function update($new_instance, $old_instance) { $instance = $old_instance; /* Strip tags for title and name to remove HTML (important for text inputs). */ $instance['title'] = strip_tags($new_instance['title']); //$instance['thumbs'] = strip_tags($new_instance['thumbs']); return $instance; } /** * Displays the widget settings controls on the widget panel. * Make use of the get_field_id() and get_field_name() function * when creating your form elements. This handles the confusing stuff. */ function form($instance) { /* Set up some default widget settings. */ $defaults = array('title' => __('Contact Widget', 'bj'), 'user' => '',); $instance = wp_parse_args((array) $instance, $defaults); ?>