diff --git a/admin/hooks/the-content.php b/admin/hooks/the-content.php
index fd20a56f..4cae20cf 100644
--- a/admin/hooks/the-content.php
+++ b/admin/hooks/the-content.php
@@ -73,9 +73,6 @@ function sportspress_default_list_content( $content ) {
$id = get_the_ID();
$format = get_post_meta( $id, 'sp_format', true );
switch ( $format ):
- case 'roster':
- $list = sportspress_player_roster( $id );
- break;
case 'gallery':
$list = sportspress_player_gallery( $id );
break;
diff --git a/admin/templates/player-gallery.php b/admin/templates/player-gallery.php
index 7be26ed8..75493de0 100644
--- a/admin/templates/player-gallery.php
+++ b/admin/templates/player-gallery.php
@@ -6,15 +6,34 @@ if ( !function_exists( 'sportspress_player_gallery' ) ) {
$id = get_the_ID();
$defaults = array(
- 'statistics' => null,
'orderby' => 'default',
'order' => 'ASC',
+ 'itemtag' => 'dl',
+ 'icontag' => 'dt',
+ 'captiontag' => 'dd',
+ 'columns' => 3,
+ 'size' => 'thumbnail',
);
$r = wp_parse_args( $args, $defaults );
- $output = '
' .
- '
' . '' . '';
+ $itemtag = tag_escape( $r['itemtag'] );
+ $captiontag = tag_escape( $r['captiontag'] );
+ $icontag = tag_escape( $r['icontag'] );
+ $valid_tags = wp_kses_allowed_html( 'post' );
+ if ( ! isset( $valid_tags[ $itemtag ] ) )
+ $itemtag = 'dl';
+ if ( ! isset( $valid_tags[ $captiontag ] ) )
+ $captiontag = 'dd';
+ if ( ! isset( $valid_tags[ $icontag ] ) )
+ $icontag = 'dt';
+
+ $columns = intval( $r['columns'] );
+ $itemwidth = $columns > 0 ? floor(100/$columns) : 100;
+ $size = $r[ 'size' ];
+ $float = is_rtl() ? 'right' : 'left';
+
+ $selector = 'sp-player-gallery-' . $id;
$data = sportspress_get_player_list_data( $id );
@@ -40,52 +59,62 @@ if ( !function_exists( 'sportspress_player_gallery' ) ) {
uasort( $data, 'sportspress_sort_list_players' );
endif;
- if ( in_array( $r['orderby'], array( 'number', 'name' ) ) ):
- $output .= '| # | ';
- else:
- $output .= '' . __( 'Rank', 'sportspress' ) . ' | ';
- endif;
-
- foreach( $labels as $key => $label ):
- if ( ! is_array( $statistics ) || $key == 'name' || in_array( $key, $statistics ) )
- $output .= ''. $label . ' | ';
- endforeach;
-
- $output .= '
' . '' . '';
-
$i = 0;
- foreach( $data as $player_id => $row ):
+ $gallery_style = $gallery_div = '';
+ if ( apply_filters( 'use_default_gallery_style', true ) )
+ $gallery_style = "
+ ";
+ $size_class = sanitize_html_class( $size );
+ $gallery_div = "";
+ $output = apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );
- $output .= '
';
+ foreach( $data as $id => $statistics ):
+
+ $caption = get_the_title( $id );
+
+ $thumbnail = get_the_post_thumbnail( $id, $size );
+
+ if ( $thumbnail ):
+ $output .= "<{$itemtag} class='gallery-item'>";
+ $output .= "
+ <{$icontag} class='gallery-icon portrait'>"
+ . '' . $thumbnail . ''
+ . "{$icontag}>";
+ if ( $captiontag && trim($caption) ) {
+ $output .= "
+ <{$captiontag} class='wp-caption-text gallery-caption'>
+ " . wptexturize($caption) . "
+ {$captiontag}>";
+ }
+ $output .= "{$itemtag}>";
+ if ( $columns > 0 && ++$i % $columns == 0 )
+ $output .= '
';
- // Rank or number
- if ( isset( $r['orderby'] ) && $r['orderby'] != 'number' ):
- $output .= '' . ( $i + 1 ) . ' | ';
- else:
- $number = get_post_meta( $player_id, 'sp_number', true );
- $output .= '' . ( $number ? $number : ' ' ) . ' | ';
endif;
- // Name as link
- $permalink = get_post_permalink( $player_id );
- $name = sportspress_array_value( $row, 'name', sportspress_array_value( $row, 'name', ' ' ) );
- $output .= '' . '' . $name . ' | ';
-
- foreach( $labels as $key => $value ):
- if ( $key == 'name' )
- continue;
- if ( ! is_array( $statistics ) || in_array( $key, $statistics ) )
- $output .= '' . sportspress_array_value( $row, $key, '—' ) . ' | ';
- endforeach;
-
- $output .= '
';
-
- $i++;
-
endforeach;
- $output .= '
' . '
' . '
';
+ $output .= "
+
+ \n";
return apply_filters( 'sportspress_player_gallery', $output );
diff --git a/sportspress.php b/sportspress.php
index 7b84c984..f519314b 100644
--- a/sportspress.php
+++ b/sportspress.php
@@ -47,7 +47,7 @@ require_once dirname( __FILE__ ) . '/admin/templates/events-calendar.php';
require_once dirname( __FILE__ ) . '/admin/templates/league-table.php';
require_once dirname( __FILE__ ) . '/admin/templates/player-league-statistics.php';
require_once dirname( __FILE__ ) . '/admin/templates/player-list.php';
-require_once dirname( __FILE__ ) . '/admin/templates/player-roster.php';
+//require_once dirname( __FILE__ ) . '/admin/templates/player-roster.php';
require_once dirname( __FILE__ ) . '/admin/templates/player-gallery.php';
require_once dirname( __FILE__ ) . '/admin/templates/player-metrics.php';
require_once dirname( __FILE__ ) . '/admin/templates/player-statistics.php';