Add star number option to overlay number on star icon
This commit is contained in:
@@ -291,6 +291,14 @@
|
||||
.sp-event-performance .sp-event-star {
|
||||
color: #f4d014;
|
||||
}
|
||||
.sp-event-performance .sp-event-star-number {
|
||||
margin-left: -20px;
|
||||
width: 20px;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
font-size: smaller;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
/* Event Performance (Icons) */
|
||||
.sp-event-performance-teams .sp-template-event-performance-icons {
|
||||
|
||||
@@ -323,7 +323,7 @@ class SP_Meta_Box_Event_Performance {
|
||||
</th>
|
||||
<?php } ?>
|
||||
<?php if ( $stars_type ) { ?>
|
||||
<th><i class="dashicons dashicons-star-filled" title="<?php 2 == $stars_type ? _e( 'Number of Stars', 'sportspress' ) : _e( 'Player of the Match', 'sportspress' ); ?>"></i></th>
|
||||
<th><i class="dashicons dashicons-star-filled" title="<?php 1 == $stars_type ? _e( 'Player of the Match', 'sportspress' ) : _e( 'Stars', 'sportspress' ); ?>"></i></th>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -485,9 +485,8 @@ class SP_Meta_Box_Event_Performance {
|
||||
case 1:
|
||||
echo '<input type="checkbox" name="sp_stars[' . $player_id . ']" value="1" ' . checked( sp_array_value( $stars, $player_id, '' ) == '', false, false ) . '>';
|
||||
break;
|
||||
case 2:
|
||||
default:
|
||||
echo '<input type="text" name="sp_stars[' . $player_id . ']" class="tiny-text sp-player-stars-input sp-sync-input" value="' . sp_array_value( $stars, $player_id, '' ) . '">';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
||||
@@ -363,7 +363,8 @@ class SP_Settings_Events extends SP_Settings_Page {
|
||||
'options' => array(
|
||||
__( 'None', 'sportspress' ),
|
||||
__( 'Player of the Match', 'sportspress' ),
|
||||
__( 'Number of Stars', 'sportspress' ),
|
||||
__( 'Stars', 'sportspress' ),
|
||||
__( 'Star Number', 'sportspress' ),
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@ if ( ! isset( $subs ) ) $subs = array();
|
||||
|
||||
$data = apply_filters( 'sportspress_event_performance_players', $data, $lineups, $subs, $mode );
|
||||
|
||||
$stars_type = get_option( 'sportspress_event_performance_stars_type', 0 );
|
||||
|
||||
$i = 0;
|
||||
foreach ( $data as $player_id => $row ):
|
||||
|
||||
@@ -90,9 +92,21 @@ if ( ! isset( $subs ) ) $subs = array();
|
||||
$name = '<a href="' . $permalink . '">' . $name . '</a>';
|
||||
endif;
|
||||
|
||||
$player_stars = sp_array_value( $stars, $player_id, 0 );
|
||||
if ( $player_stars ):
|
||||
$name .= ' <span class="sp-event-stars">' . str_repeat( '<i class="sp-event-star dashicons dashicons-star-filled" title="' . __( 'Player of the Match', 'sportspress' ) . '"></i>', $player_stars ) . '<span>';
|
||||
if ( $stars_type ):
|
||||
$player_stars = sp_array_value( $stars, $player_id, 0 );
|
||||
if ( $player_stars ):
|
||||
switch ( $stars_type ):
|
||||
case 1:
|
||||
$name .= ' <span class="sp-event-stars"><i class="sp-event-star dashicons dashicons-star-filled" title="' . __( 'Player of the Match', 'sportspress' ) . '"></i><span>';
|
||||
break;
|
||||
case 2:
|
||||
$name .= ' <span class="sp-event-stars">' . str_repeat( '<i class="sp-event-star dashicons dashicons-star-filled" title="' . __( 'Stars', 'sportspress' ) . '"></i>', $player_stars ) . '<span>';
|
||||
break;
|
||||
case 3:
|
||||
$name .= ' <span class="sp-event-stars"><i class="sp-event-star sp-event-star-' . $player_stars . ' dashicons dashicons-star-filled" title="' . __( 'Stars', 'sportspress' ) . '"></i><span class="sp-event-star-number">' . $player_stars . '</span><span>';
|
||||
break;
|
||||
endswitch;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( array_key_exists( $player_id, $lineup_sub_relation ) ):
|
||||
|
||||
Reference in New Issue
Block a user