Add option to display team logos in event list close #87
This commit is contained in:
@@ -202,9 +202,16 @@
|
||||
.sp-event-list .data-article a .dashicons {
|
||||
padding-right: 3px;
|
||||
}
|
||||
.sp-event-list .data-time {
|
||||
.sp-event-list .data-time,
|
||||
.sp-event-list .data-results {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.sp-event-list .data-teams img,
|
||||
.sp-event-list .data-home img,
|
||||
.sp-event-list .data-away img {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* Event Blocks */
|
||||
.sp-event-blocks thead {
|
||||
|
||||
@@ -63,18 +63,20 @@ class SP_Meta_Box_Calendar_Data {
|
||||
?>
|
||||
</label>
|
||||
</th>
|
||||
<th class="column-time">
|
||||
<label for="sp_columns_time">
|
||||
<input type="checkbox" name="sp_columns[]" value="time" id="sp_columns_time" <?php checked( ! is_array( $usecolumns ) || in_array( 'time', $usecolumns ) ); ?>>
|
||||
<?php
|
||||
if ( 'time' == $time_format || 'separate' == $time_format ) {
|
||||
_e( 'Time', 'sportspress' );
|
||||
} else {
|
||||
_e( 'Time/Results', 'sportspress' );
|
||||
}
|
||||
?>
|
||||
</label>
|
||||
</th>
|
||||
<?php if ( in_array( $time_format, array( 'combined', 'separate', 'time' ) ) ) { ?>
|
||||
<th class="column-time">
|
||||
<label for="sp_columns_time">
|
||||
<input type="checkbox" name="sp_columns[]" value="time" id="sp_columns_time" <?php checked( ! is_array( $usecolumns ) || in_array( 'time', $usecolumns ) ); ?>>
|
||||
<?php
|
||||
if ( 'time' == $time_format || 'separate' == $time_format ) {
|
||||
_e( 'Time', 'sportspress' );
|
||||
} else {
|
||||
_e( 'Time/Results', 'sportspress' );
|
||||
}
|
||||
?>
|
||||
</label>
|
||||
</th>
|
||||
<?php } ?>
|
||||
<?php if ( in_array( $time_format, array( 'separate', 'results' ) ) ) { ?>
|
||||
<th class="column-results">
|
||||
<label for="sp_columns_results">
|
||||
|
||||
@@ -174,6 +174,14 @@ class SP_Settings_Events extends SP_Settings_Page {
|
||||
|
||||
array( 'title' => __( 'Event List', 'sportspress' ), 'type' => 'title', 'id' => 'event_list_options' ),
|
||||
|
||||
array(
|
||||
'title' => __( 'Teams', 'sportspress' ),
|
||||
'desc' => __( 'Display logos', 'sportspress' ),
|
||||
'id' => 'sportspress_event_list_show_logos',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Title Format', 'sportspress' ),
|
||||
'id' => 'sportspress_event_list_title_format',
|
||||
|
||||
@@ -16,6 +16,7 @@ $defaults = array(
|
||||
'date_from' => 'default',
|
||||
'date_to' => 'default',
|
||||
'number' => -1,
|
||||
'show_team_logo' => get_option( 'sportspress_event_list_show_logos', 'no' ) == 'yes' ? true : false,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
'link_venues' => get_option( 'sportspress_link_venues', 'yes' ) == 'yes' ? true : false,
|
||||
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
@@ -93,30 +94,35 @@ if ( $id ) {
|
||||
|
||||
switch ( $time_format ) {
|
||||
case 'separate':
|
||||
echo '<th class="data-time">' . __( 'Time', 'sportspress' ) . '</th>';
|
||||
echo '<th class="data-results">' . __( 'Results', 'sportspress' ) . '</th>';
|
||||
if ( sp_column_active( $usecolumns, 'time' ) )
|
||||
echo '<th class="data-time">' . __( 'Time', 'sportspress' ) . '</th>';
|
||||
if ( sp_column_active( $usecolumns, 'results' ) )
|
||||
echo '<th class="data-results">' . __( 'Results', 'sportspress' ) . '</th>';
|
||||
break;
|
||||
case 'time':
|
||||
echo '<th class="data-time">' . __( 'Time', 'sportspress' ) . '</th>';
|
||||
if ( sp_column_active( $usecolumns, 'time' ) )
|
||||
echo '<th class="data-time">' . __( 'Time', 'sportspress' ) . '</th>';
|
||||
break;
|
||||
case 'results':
|
||||
echo '<th class="data-results">' . __( 'Results', 'sportspress' ) . '</th>';
|
||||
if ( sp_column_active( $usecolumns, 'results' ) )
|
||||
echo '<th class="data-results">' . __( 'Results', 'sportspress' ) . '</th>';
|
||||
break;
|
||||
default:
|
||||
echo '<th class="data-time">' . __( 'Time/Results', 'sportspress' ) . '</th>';
|
||||
if ( sp_column_active( $usecolumns, 'time' ) )
|
||||
echo '<th class="data-time">' . __( 'Time/Results', 'sportspress' ) . '</th>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $usecolumns == null || in_array( 'league', $usecolumns ) )
|
||||
if ( sp_column_active( $usecolumns, 'league' ) )
|
||||
echo '<th class="data-league">' . __( 'Competition', 'sportspress' ) . '</th>';
|
||||
|
||||
if ( $usecolumns == null || in_array( 'season', $usecolumns ) )
|
||||
if ( sp_column_active( $usecolumns, 'season' ) )
|
||||
echo '<th class="data-season">' . __( 'Season', 'sportspress' ) . '</th>';
|
||||
|
||||
if ( $usecolumns == null || in_array( 'venue', $usecolumns ) )
|
||||
if ( sp_column_active( $usecolumns, 'venue' ) )
|
||||
echo '<th class="data-venue">' . __( 'Venue', 'sportspress' ) . '</th>';
|
||||
|
||||
if ( $usecolumns == null || in_array( 'article', $usecolumns ) )
|
||||
if ( sp_column_active( $usecolumns, 'article' ) )
|
||||
echo '<th class="data-article">' . __( 'Article', 'sportspress' ) . '</th>';
|
||||
?>
|
||||
</tr>
|
||||
@@ -138,11 +144,18 @@ if ( $id ) {
|
||||
|
||||
$teams_output = '';
|
||||
$teams_array = array();
|
||||
$team_logos = array();
|
||||
|
||||
if ( $teams ):
|
||||
foreach ( $teams as $team ):
|
||||
$name = get_the_title( $team );
|
||||
if ( $name ):
|
||||
|
||||
if ( $show_team_logo ):
|
||||
$name = sp_get_logo( $team, 'mini' ) . ' ' . $name;
|
||||
$team_logos[] = sp_get_logo( $team, 'mini' );
|
||||
endif;
|
||||
|
||||
if ( $link_teams ):
|
||||
$team_output = '<a href="' . get_post_permalink( $team ) . '">' . $name . '</a>';
|
||||
else:
|
||||
@@ -207,9 +220,9 @@ if ( $id ) {
|
||||
default:
|
||||
if ( sp_column_active( $usecolumns, 'event' ) ) {
|
||||
if ( $title_format == 'teams' )
|
||||
echo '<td class="data-event">' . $teams_output . '</td>';
|
||||
echo '<td class="data-event data-teams">' . $teams_output . '</td>';
|
||||
else
|
||||
echo '<td class="data-event"><a href="' . get_permalink( $event->ID ) . '">' . $event->post_title . '</a></td>';
|
||||
echo '<td class="data-event"><a href="' . get_permalink( $event->ID ) . '">' . implode( ' ', $team_logos ) . ' ' . $event->post_title . '</a></td>';
|
||||
}
|
||||
|
||||
switch ( $time_format ) {
|
||||
@@ -260,7 +273,7 @@ if ( $id ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( $usecolumns == null || in_array( 'league', $usecolumns ) ):
|
||||
if ( sp_column_active( $usecolumns, 'league' ) ):
|
||||
echo '<td class="data-league">';
|
||||
$leagues = get_the_terms( $event->ID, 'sp_league' );
|
||||
if ( $leagues ): foreach ( $leagues as $league ):
|
||||
@@ -269,7 +282,7 @@ if ( $id ) {
|
||||
echo '</td>';
|
||||
endif;
|
||||
|
||||
if ( $usecolumns == null || in_array( 'season', $usecolumns ) ):
|
||||
if ( sp_column_active( $usecolumns, 'season' ) ):
|
||||
echo '<td class="data-season">';
|
||||
$seasons = get_the_terms( $event->ID, 'sp_season' );
|
||||
if ( $seasons ): foreach ( $seasons as $season ):
|
||||
@@ -278,7 +291,7 @@ if ( $id ) {
|
||||
echo '</td>';
|
||||
endif;
|
||||
|
||||
if ( $usecolumns == null || in_array( 'venue', $usecolumns ) ):
|
||||
if ( sp_column_active( $usecolumns, 'venue' ) ):
|
||||
echo '<td class="data-venue">';
|
||||
if ( $link_venues ):
|
||||
the_terms( $event->ID, 'sp_venue' );
|
||||
@@ -291,7 +304,7 @@ if ( $id ) {
|
||||
echo '</td>';
|
||||
endif;
|
||||
|
||||
if ( $usecolumns == null || in_array( 'article', $usecolumns ) ):
|
||||
if ( sp_column_active( $usecolumns, 'article' ) ):
|
||||
echo '<td class="data-article">
|
||||
<a href="' . get_permalink( $event->ID ) . '">';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user