'widget_player_gallery widget_sp_player_gallery', 'description' => __( 'Display a gallery of players.', 'sportspress' ) ); parent::__construct('sp_player_gallery', __( 'Player Gallery', 'sportspress' ) . ' (' . __( 'SportsPress', 'sportspress' ) . ')', $widget_ops); } function widget( $args, $instance ) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $id = empty($instance['id']) ? null : $instance['id']; $number = empty($instance['number']) ? null : $instance['number']; $orderby = empty($instance['orderby']) ? 'default' : $instance['orderby']; $order = empty($instance['order']) ? 'ASC' : $instance['order']; $show_all_players_link = empty($instance['show_all_players_link']) ? false : $instance['show_all_players_link']; $show_names_on_hover = empty($instance['show_names_on_hover']) ? false : $instance['show_names_on_hover']; echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; echo ''; echo $after_widget; } function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); $instance['id'] = intval($new_instance['id']); $instance['number'] = intval($new_instance['number']); $instance['orderby'] = strip_tags($new_instance['orderby']); $instance['order'] = strip_tags($new_instance['order']); $instance['show_all_players_link'] = $new_instance['show_all_players_link']; $instance['show_names_on_hover'] = $new_instance['show_names_on_hover']; return $instance; } function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '', 'number' => 5, 'orderby' => 'default', 'order' => 'ASC', 'show_all_players_link' => true, 'show_names_on_hover' => false ) ); $title = strip_tags($instance['title']); $id = intval($instance['id']); $number = intval($instance['number']); $orderby = strip_tags($instance['orderby']); $order = strip_tags($instance['order']); $show_all_players_link = $instance['show_all_players_link']; $show_names_on_hover = $instance['show_names_on_hover']; ?>

'sp_list', 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), 'selected' => $id, 'values' => 'ID', 'class' => 'widefat', ); if ( ! sp_dropdown_pages( $args ) ): sp_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) ); endif; ?>

array( 'default' => __( 'Default', 'sportspress' ), 'number' => __( 'Number', 'sportspress' ), 'name' => __( 'Name', 'sportspress' ), 'eventsplayed' => __( 'Played', 'sportspress' ) ), 'post_type' => 'sp_performance', 'name' => $this->get_field_name('orderby'), 'id' => $this->get_field_id('orderby'), 'selected' => $orderby, 'values' => 'slug', 'class' => 'sp-select-orderby widefat', ); if ( ! sp_dropdown_pages( $args ) ): sp_post_adder( 'sp_list', __( 'Add New', 'sportspress' ) ); endif; ?>

>

>