Add table heading option to widgets

This commit is contained in:
Brian Miyaji
2015-07-17 15:32:29 +10:00
parent f3c6a6878b
commit f7742a69cd
18 changed files with 162 additions and 53 deletions

View File

@@ -2,13 +2,14 @@
class SP_Widget_Countdown extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_countdown widget_sp_countdown', 'description' => __( 'A clock that counts down to an upcoming event.', 'sportspress' ) );
$widget_ops = array('classname' => 'widget_sportspress widget_countdown widget_sp_countdown', 'description' => __( 'A clock that counts down to an upcoming event.', 'sportspress' ) );
parent::__construct('sportspress-countdown', __( 'Countdown', 'sportspress' ), $widget_ops);
}
function widget( $args, $instance ) {
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? null : $instance['title'], $instance, $this->id_base);
$caption = empty($instance['caption']) ? null : $instance['caption'];
$team = empty($instance['team']) ? null : $instance['team'];
$id = empty($instance['id']) ? null : $instance['id'];
$show_venue = empty($instance['show_venue']) ? false : $instance['show_venue'];
@@ -23,7 +24,7 @@ class SP_Widget_Countdown extends WP_Widget {
// Action to hook into
do_action( 'sportspress_before_widget_template', $args, $instance, 'countdown' );
sp_get_template( 'countdown.php', array( 'team' => $team, 'id' => $id, 'show_venue' => $show_venue, 'show_league' => $show_league ) );
sp_get_template( 'countdown.php', array( 'team' => $team, 'id' => $id, 'title' => $caption, 'show_venue' => $show_venue, 'show_league' => $show_league ) );
// Action to hook into
do_action( 'sportspress_after_widget_template', $args, $instance, 'countdown' );
@@ -36,6 +37,7 @@ class SP_Widget_Countdown extends WP_Widget {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['team'] = intval($new_instance['team']);
$instance['caption'] = strip_tags($new_instance['caption']);
$instance['id'] = intval($new_instance['id']);
$instance['show_venue'] = intval($new_instance['show_venue']);
$instance['show_league'] = intval($new_instance['show_league']);
@@ -47,8 +49,9 @@ class SP_Widget_Countdown extends WP_Widget {
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'team' => '', 'id' => '', 'show_venue' => false, 'show_league' => false ) );
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'team' => '', 'id' => '', 'caption' => '', 'show_venue' => false, 'show_league' => false ) );
$title = strip_tags($instance['title']);
$caption = strip_tags($instance['caption']);
$team = intval($instance['team']);
$id = intval($instance['id']);
$show_venue = intval($instance['show_venue']);
@@ -60,6 +63,9 @@ class SP_Widget_Countdown extends WP_Widget {
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('caption'); ?>"><?php _e( 'Heading:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('caption'); ?>" name="<?php echo $this->get_field_name('caption'); ?>" type="text" value="<?php echo esc_attr($caption); ?>" /></p>
<p class="sp-dropdown-filter"><label for="<?php echo $this->get_field_id('team'); ?>"><?php printf( __( 'Select %s:', 'sportspress' ), __( 'Team', 'sportspress' ) ); ?></label>
<?php
$args = array(

View File

@@ -2,7 +2,7 @@
class SP_Widget_Event_Blocks extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_sp_event_blocks', 'description' => __( 'A list of events.', 'sportspress' ) );
$widget_ops = array('classname' => 'widget_sportspress widget_sp_event_blocks', 'description' => __( 'A list of events.', 'sportspress' ) );
parent::__construct('sportspress-event-blocks', __( 'Event Blocks', 'sportspress' ), $widget_ops);
}
@@ -10,6 +10,7 @@ class SP_Widget_Event_Blocks extends WP_Widget {
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$id = empty($instance['id']) ? null : $instance['id'];
$caption = empty($instance['caption']) ? null : $instance['caption'];
$status = empty($instance['status']) ? 'default' : $instance['status'];
$date = empty($instance['date']) ? 'default' : $instance['date'];
$date_from = empty($instance['date_from']) ? 'default' : $instance['date_from'];
@@ -27,7 +28,7 @@ class SP_Widget_Event_Blocks extends WP_Widget {
// Action to hook into
do_action( 'sportspress_before_widget_template', $args, $instance, 'event-blocks' );
sp_get_template( 'event-blocks.php', array( 'id' => $id, 'status' => $status, 'date' => $date, 'date_from' => $date_from, 'date_to' => $date_to, 'number' => $number, 'order' => $order, 'show_all_events_link' => $show_all_events_link ) );
sp_get_template( 'event-blocks.php', array( 'id' => $id, 'title' => $caption, 'status' => $status, 'date' => $date, 'date_from' => $date_from, 'date_to' => $date_to, 'number' => $number, 'order' => $order, 'show_all_events_link' => $show_all_events_link ) );
// Action to hook into
do_action( 'sportspress_after_widget_template', $args, $instance, 'event-blocks' );
@@ -40,6 +41,7 @@ class SP_Widget_Event_Blocks extends WP_Widget {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['id'] = intval($new_instance['id']);
$instance['caption'] = strip_tags($new_instance['caption']);
$instance['status'] = $new_instance['status'];
$instance['date'] = $new_instance['date'];
$instance['date_from'] = $new_instance['date_from'];
@@ -55,9 +57,10 @@ class SP_Widget_Event_Blocks extends WP_Widget {
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n( 'Y-m-d' ), 'date_to' => date_i18n( 'Y-m-d' ), 'number' => 5, 'order' => 'default', 'show_all_events_link' => true ) );
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'caption' => '', 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n( 'Y-m-d' ), 'date_to' => date_i18n( 'Y-m-d' ), 'number' => 5, 'order' => 'default', 'show_all_events_link' => true ) );
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
$caption = strip_tags($instance['caption']);
$status = $instance['status'];
$date = $instance['date'];
$date_from = $instance['date_from'];
@@ -72,6 +75,9 @@ class SP_Widget_Event_Blocks extends WP_Widget {
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('caption'); ?>"><?php _e( 'Heading:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('caption'); ?>" name="<?php echo $this->get_field_name('caption'); ?>" type="text" value="<?php echo esc_attr($caption); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('id'); ?>"><?php printf( __( 'Select %s:', 'sportspress' ), __( 'Calendar', 'sportspress' ) ); ?></label>
<?php
$args = array(

View File

@@ -2,7 +2,7 @@
class SP_Widget_Event_Calendar extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_calendar widget_sp_event_calendar', 'description' => __( 'A calendar of events.', 'sportspress' ) );
$widget_ops = array('classname' => 'widget_sportspress widget_calendar widget_sp_event_calendar', 'description' => __( 'A calendar of events.', 'sportspress' ) );
parent::__construct('sportspress-event-calendar', __( 'Event Calendar', 'sportspress' ), $widget_ops);
}

View File

@@ -2,7 +2,7 @@
class SP_Widget_Event_List extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_sp_event_list', 'description' => __( 'A list of events.', 'sportspress' ) );
$widget_ops = array('classname' => 'widget_sportspress widget_sp_event_list', 'description' => __( 'A list of events.', 'sportspress' ) );
parent::__construct('sportspress-event-list', __( 'Event List', 'sportspress' ), $widget_ops);
}
@@ -10,6 +10,7 @@ class SP_Widget_Event_List extends WP_Widget {
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$id = empty($instance['id']) ? null : $instance['id'];
$caption = empty($instance['caption']) ? null : $instance['caption'];
$status = empty($instance['status']) ? 'default' : $instance['status'];
$date = empty($instance['date']) ? 'default' : $instance['date'];
$date_from = empty($instance['date_from']) ? 'default' : $instance['date_from'];
@@ -28,7 +29,7 @@ class SP_Widget_Event_List extends WP_Widget {
// Action to hook into
do_action( 'sportspress_before_widget_template', $args, $instance, 'event-list' );
sp_get_template( 'event-list.php', array( 'id' => $id, 'status' => $status, 'date' => $date, 'date_from' => $date_from, 'date_to' => $date_to, 'number' => $number, 'columns' => $columns, 'order' => $order, 'show_all_events_link' => $show_all_events_link ) );
sp_get_template( 'event-list.php', array( 'id' => $id, 'title' => $caption, 'status' => $status, 'date' => $date, 'date_from' => $date_from, 'date_to' => $date_to, 'number' => $number, 'columns' => $columns, 'order' => $order, 'show_all_events_link' => $show_all_events_link ) );
// Action to hook into
do_action( 'sportspress_after_widget_template', $args, $instance, 'event-list' );
@@ -41,6 +42,7 @@ class SP_Widget_Event_List extends WP_Widget {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['id'] = intval($new_instance['id']);
$instance['caption'] = strip_tags($new_instance['caption']);
$instance['status'] = $new_instance['status'];
$instance['date'] = $new_instance['date'];
$instance['date_from'] = $new_instance['date_from'];
@@ -57,9 +59,10 @@ class SP_Widget_Event_List extends WP_Widget {
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n( 'Y-m-d' ), 'date_to' => date_i18n( 'Y-m-d' ), 'number' => 5, 'columns' => null, 'order' => 'default', 'show_all_events_link' => true ) );
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'caption' => '', 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n( 'Y-m-d' ), 'date_to' => date_i18n( 'Y-m-d' ), 'number' => 5, 'columns' => null, 'order' => 'default', 'show_all_events_link' => true ) );
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
$caption = strip_tags($instance['caption']);
$status = $instance['status'];
$date = $instance['date'];
$date_from = $instance['date_from'];
@@ -75,6 +78,9 @@ class SP_Widget_Event_List extends WP_Widget {
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('caption'); ?>"><?php _e( 'Heading:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('caption'); ?>" name="<?php echo $this->get_field_name('caption'); ?>" type="text" value="<?php echo esc_attr($caption); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('id'); ?>"><?php printf( __( 'Select %s:', 'sportspress' ), __( 'Calendar', 'sportspress' ) ); ?></label>
<?php
$args = array(

View File

@@ -2,7 +2,7 @@
class SP_Widget_League_Table extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_league_table widget_sp_league_table', 'description' => __( 'Display a league table.', 'sportspress' ) );
$widget_ops = array('classname' => 'widget_sportspress widget_league_table widget_sp_league_table', 'description' => __( 'Display a league table.', 'sportspress' ) );
parent::__construct('sportspress-league-table', __( 'League Table', 'sportspress' ), $widget_ops);
}
@@ -11,6 +11,7 @@ class SP_Widget_League_Table extends WP_Widget {
$id = empty($instance['id']) ? 0 : $instance['id'];
if ( $id <= 0 ) return;
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$caption = empty($instance['caption']) ? null : $instance['caption'];
$number = empty($instance['number']) ? null : $instance['number'];
$columns = empty($instance['columns']) ? array() : $instance['columns'];
$show_team_logo = empty($instance['show_team_logo']) ? false : $instance['show_team_logo'];
@@ -25,7 +26,7 @@ class SP_Widget_League_Table extends WP_Widget {
// Action to hook into
do_action( 'sportspress_before_widget_template', $args, $instance, 'league-table' );
sp_get_template( 'league-table.php', array( 'id' => $id, 'number' => $number, 'columns' => $columns, 'show_full_table_link' => $show_full_table_link, 'show_team_logo' => $show_team_logo ) );
sp_get_template( 'league-table.php', array( 'id' => $id, 'title' => $caption, 'number' => $number, 'columns' => $columns, 'show_full_table_link' => $show_full_table_link, 'show_team_logo' => $show_team_logo ) );
// Action to hook into
do_action( 'sportspress_after_widget_template', $args, $instance, 'league-table' );
@@ -38,6 +39,7 @@ class SP_Widget_League_Table extends WP_Widget {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['id'] = intval($new_instance['id']);
$instance['caption'] = strip_tags($new_instance['caption']);
$instance['number'] = intval($new_instance['number']);
$instance['columns'] = (array)$new_instance['columns'];
$instance['show_team_logo'] = $new_instance['show_team_logo'];
@@ -50,10 +52,11 @@ class SP_Widget_League_Table extends WP_Widget {
}
function form( $instance ) {
$defaults = apply_filters( 'sportspress_widget_defaults', array( 'title' => '', 'id' => '', 'number' => 5, 'columns' => null, 'show_team_logo' => false, 'show_full_table_link' => true ) );
$defaults = apply_filters( 'sportspress_widget_defaults', array( 'title' => '', 'id' => '', 'caption' => '', 'number' => 5, 'columns' => null, 'show_team_logo' => false, 'show_full_table_link' => true ) );
$instance = wp_parse_args( (array) $instance, $defaults );
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
$caption = strip_tags($instance['caption']);
$number = intval($instance['number']);
$columns = $instance['columns'];
$show_team_logo = $instance['show_team_logo'];
@@ -65,6 +68,9 @@ class SP_Widget_League_Table extends WP_Widget {
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('caption'); ?>"><?php _e( 'Heading:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('caption'); ?>" name="<?php echo $this->get_field_name('caption'); ?>" type="text" value="<?php echo esc_attr($caption); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('id'); ?>"><?php printf( __( 'Select %s:', 'sportspress' ), __( 'League Table', 'sportspress' ) ); ?></label>
<?php
$args = array(

View File

@@ -2,7 +2,7 @@
class SP_Widget_Player_Gallery extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_player_gallery widget_sp_player_gallery', 'description' => __( 'Display a gallery of players.', 'sportspress' ) );
$widget_ops = array('classname' => 'widget_sportspress widget_player_gallery widget_sp_player_gallery', 'description' => __( 'Display a gallery of players.', 'sportspress' ) );
parent::__construct('sportspress-player-gallery', __( 'Player Gallery', 'sportspress' ), $widget_ops);
}
@@ -11,6 +11,7 @@ class SP_Widget_Player_Gallery extends WP_Widget {
$id = empty($instance['id']) ? 0 : $instance['id'];
if ( $id <= 0 ) return;
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$caption = empty($instance['caption']) ? null : $instance['caption'];
$number = empty($instance['number']) ? null : $instance['number'];
$columns = empty($instance['columns']) ? null : $instance['columns'];
$orderby = empty($instance['orderby']) ? 'default' : $instance['orderby'];
@@ -27,7 +28,7 @@ class SP_Widget_Player_Gallery extends WP_Widget {
// Action to hook into
do_action( 'sportspress_before_widget_template', $args, $instance, 'player-gallery' );
sp_get_template( 'player-gallery.php', array( 'id' => $id, 'number' => $number, 'columns' => $columns, 'orderby' => $orderby , 'order' => $order, 'grouping' => 0, 'show_all_players_link' => $show_all_players_link, 'show_names_on_hover' => $show_names_on_hover ) );
sp_get_template( 'player-gallery.php', array( 'id' => $id, 'title' => $caption, 'number' => $number, 'columns' => $columns, 'orderby' => $orderby , 'order' => $order, 'grouping' => 0, 'show_all_players_link' => $show_all_players_link, 'show_names_on_hover' => $show_names_on_hover ) );
// Action to hook into
do_action( 'sportspress_after_widget_template', $args, $instance, 'player-gallery' );
@@ -40,6 +41,7 @@ class SP_Widget_Player_Gallery extends WP_Widget {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['id'] = intval($new_instance['id']);
$instance['caption'] = strip_tags($new_instance['caption']);
$instance['number'] = intval($new_instance['number']);
$instance['columns'] = intval($new_instance['columns']);
$instance['orderby'] = strip_tags($new_instance['orderby']);
@@ -54,9 +56,10 @@ class SP_Widget_Player_Gallery extends WP_Widget {
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '', 'number' => 5, 'columns' => 2, 'orderby' => 'default', 'order' => 'ASC', 'show_all_players_link' => true, 'show_names_on_hover' => false ) );
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '', 'caption' => '', 'number' => 5, 'columns' => 2, 'orderby' => 'default', 'order' => 'ASC', 'show_all_players_link' => true, 'show_names_on_hover' => false ) );
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
$caption = strip_tags($instance['caption']);
$number = intval($instance['number']);
$columns = intval($instance['columns']);
$orderby = strip_tags($instance['orderby']);
@@ -70,6 +73,9 @@ class SP_Widget_Player_Gallery extends WP_Widget {
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('caption'); ?>"><?php _e( 'Heading:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('caption'); ?>" name="<?php echo $this->get_field_name('caption'); ?>" type="text" value="<?php echo esc_attr($caption); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('id'); ?>"><?php printf( __( 'Select %s:', 'sportspress' ), __( 'Player List', 'sportspress' ) ); ?></label>
<?php
$args = array(

View File

@@ -2,7 +2,7 @@
class SP_Widget_Player_list extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_player_list widget_sp_player_list', 'description' => __( 'Display a list of players.', 'sportspress' ) );
$widget_ops = array('classname' => 'widget_sportspress widget_player_list widget_sp_player_list', 'description' => __( 'Display a list of players.', 'sportspress' ) );
parent::__construct('sportspress-player-list', __( 'Player List', 'sportspress' ), $widget_ops);
}
@@ -11,6 +11,7 @@ class SP_Widget_Player_list extends WP_Widget {
$id = empty($instance['id']) ? 0 : $instance['id'];
if ( $id <= 0 ) return;
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$caption = empty($instance['caption']) ? null : $instance['caption'];
$number = empty($instance['number']) ? null : $instance['number'];
$columns = $instance['columns'];
$orderby = empty($instance['orderby']) ? 'default' : $instance['orderby'];
@@ -26,7 +27,7 @@ class SP_Widget_Player_list extends WP_Widget {
// Action to hook into
do_action( 'sportspress_before_widget_template', $args, $instance, 'player-list' );
sp_get_template( 'player-list.php', array( 'id' => $id, 'number' => $number, 'columns' => $columns, 'orderby' => $orderby, 'order' => $order, 'grouping' => 0, 'show_all_players_link' => $show_all_players_link ) );
sp_get_template( 'player-list.php', array( 'id' => $id, 'title' => $caption, 'number' => $number, 'columns' => $columns, 'orderby' => $orderby, 'order' => $order, 'grouping' => 0, 'show_all_players_link' => $show_all_players_link ) );
// Action to hook into
do_action( 'sportspress_after_widget_template', $args, $instance, 'player-list' );
@@ -39,6 +40,7 @@ class SP_Widget_Player_list extends WP_Widget {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['id'] = intval($new_instance['id']);
$instance['caption'] = strip_tags($new_instance['caption']);
$instance['number'] = intval($new_instance['number']);
$instance['columns'] = (array)$new_instance['columns'];
$instance['orderby'] = strip_tags($new_instance['orderby']);
@@ -52,9 +54,10 @@ class SP_Widget_Player_list extends WP_Widget {
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '', 'number' => 5, 'columns' => null, 'orderby' => 'default', 'order' => 'ASC', 'show_all_players_link' => true ) );
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '', 'caption' => '', 'number' => 5, 'columns' => null, 'orderby' => 'default', 'order' => 'ASC', 'show_all_players_link' => true ) );
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
$caption = strip_tags($instance['caption']);
$number = intval($instance['number']);
$columns = $instance['columns'];
$orderby = strip_tags($instance['orderby']);
@@ -67,6 +70,9 @@ class SP_Widget_Player_list extends WP_Widget {
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('caption'); ?>"><?php _e( 'Heading:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('caption'); ?>" name="<?php echo $this->get_field_name('caption'); ?>" type="text" value="<?php echo esc_attr($caption); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('id'); ?>"><?php printf( __( 'Select %s:', 'sportspress' ), __( 'Player List', 'sportspress' ) ); ?></label>
<?php
$args = array(

View File

@@ -2,7 +2,7 @@
class SP_Widget_Staff extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_staff widget_sp_staff', 'description' => __( 'Display a single staff member.', 'sportspress' ) );
$widget_ops = array('classname' => 'widget_sportspress widget_staff widget_sp_staff', 'description' => __( 'Display a single staff member.', 'sportspress' ) );
parent::__construct('sportspress-staff', __( 'Staff', 'sportspress' ), $widget_ops);
}
@@ -20,6 +20,8 @@ class SP_Widget_Staff extends WP_Widget {
// Action to hook into
do_action( 'sportspress_before_widget_template', $args, $instance, 'staff' );
echo '<h4 class="sp-table-caption">' . get_the_title( $id ) . '</h4>';
sp_get_template( 'staff-photo.php', array( 'id' => $id ) );
sp_get_template( 'staff-details.php', array( 'id' => $id ) );