Display league/season in event blocks close #36

This commit is contained in:
Brian Miyaji
2014-08-24 18:21:23 +10:00
parent 2a2c27ab19
commit 88b528634d
6 changed files with 73 additions and 5 deletions

View File

@@ -186,6 +186,10 @@
padding: 0 20px;
clear: none;
}
.sp-event-blocks .event-league,
.sp-event-blocks .event-season {
text-align: center;
}
.sp-event-blocks .team-logo {
width: 20%;
height: auto;

View File

@@ -432,8 +432,10 @@ jQuery(document).ready(function($){
$(".sp-calendar-table tr").each(function() {
if ( layout == "list" ) {
$(this).find("th input[type=checkbox]").show();
$(this).find("th select").prop("disabled", false);
} else {
$(this).find("th input[type=checkbox]").hide();
$(this).find("th select").prop('selectedIndex', 0).prop("disabled", true);
}
});
});

View File

@@ -64,6 +64,18 @@ class SP_Meta_Box_Calendar_Data {
<?php _e( 'Time/Results', 'sportspress' ); ?>
</label>
</th>
<th class="column-league">
<label for="sp_columns_league">
<input type="checkbox" name="sp_columns[]" value="league" id="sp_columns_league" <?php checked( ! is_array( $usecolumns ) || in_array( 'league', $usecolumns ) ); ?>>
<?php _e( 'League', 'sportspress' ); ?>
</label>
</th>
<th class="column-season">
<label for="sp_columns_season">
<input type="checkbox" name="sp_columns[]" value="season" id="sp_columns_season" <?php checked( ! is_array( $usecolumns ) || in_array( 'season', $usecolumns ) ); ?>>
<?php _e( 'Season', 'sportspress' ); ?>
</label>
</th>
<th class="column-venue">
<label for="sp_columns_venue">
<input type="checkbox" name="sp_columns[]" value="venue" id="sp_columns_venue" <?php checked( ! is_array( $usecolumns ) || in_array( 'venue', $usecolumns ) ); ?>>
@@ -136,6 +148,8 @@ class SP_Meta_Box_Calendar_Data {
endif;
?>
</td>
<td><?php the_terms( $event->ID, 'sp_league' ); ?></td>
<td><?php the_terms( $event->ID, 'sp_season' ); ?></td>
<td><?php the_terms( $event->ID, 'sp_venue' ); ?></td>
<td>
<a href="<?php echo get_edit_post_link( $event->ID ); ?>#sp_articlediv">

View File

@@ -83,7 +83,6 @@ class SP_Settings_Events extends SP_Settings_Page {
),
array(
'title' => __( 'Player Performance', 'sportspress' ),
'desc' => __( 'Display players', 'sportspress' ),
'id' => 'sportspress_event_show_players',
'default' => 'yes',
@@ -157,6 +156,23 @@ class SP_Settings_Events extends SP_Settings_Page {
array( 'title' => __( 'Event Blocks', 'sportspress' ), 'type' => 'title', 'id' => 'event_blocks_options' ),
array(
'title' => __( 'Details', 'sportspress' ),
'desc' => __( 'Display league', 'sportspress' ),
'id' => 'sportspress_event_blocks_show_league',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'start',
),
array(
'desc' => __( 'Display season', 'sportspress' ),
'id' => 'sportspress_event_blocks_show_season',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'end',
),
array(
'title' => __( 'Pagination', 'sportspress' ),
'desc' => __( 'Paginate', 'sportspress' ),

View File

@@ -4,7 +4,7 @@
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 1.1
* @version 1.3
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -20,6 +20,8 @@ $defaults = array(
'rows' => get_option( 'sportspress_event_blocks_rows', 10 ),
'order' => 'default',
'show_all_events_link' => false,
'show_league' => get_option( 'sportspress_event_blocks_show_league', 'no' ) == 'yes' ? true : false,
'show_season' => get_option( 'sportspress_event_blocks_show_season', 'no' ) == 'yes' ? true : false,
);
extract( $defaults, EXTR_SKIP );
@@ -89,11 +91,17 @@ if ( isset( $columns ) )
<td>
<?php echo implode( $logos, ' ' ); ?>
<time class="event-date"><?php echo get_the_time( get_option( 'date_format' ), $event ); ?></time>
<?php if ( $event->post_status == 'future' ): ?>
<h5 class="event-time"><?php echo get_the_time( get_option( 'time_format' ), $event ); ?></h5>
<?php else: ?>
<?php if ( ! empty( $main_results ) ): ?>
<h5 class="event-results"><?php echo implode( $main_results, ' - ' ); ?></h5>
<?php else: ?>
<h5 class="event-time"><?php echo get_the_time( get_option( 'time_format' ), $event ); ?></h5>
<?php endif; ?>
<?php if ( $show_league ): $leagues = get_the_terms( $event, 'sp_league' ); if ( $leagues ): $league = array_shift( $leagues ); ?>
<div class="event-league"><?php echo $league->name; ?></div>
<?php endif; endif; ?>
<?php if ( $show_season ): $seasons = get_the_terms( $event, 'sp_season' ); if ( $seasons ): $season = array_shift( $seasons ); ?>
<div class="event-season"><?php echo $season->name; ?></div>
<?php endif; endif; ?>
<h4 class="event-title"><a href="<?php echo get_post_permalink( $event ); ?>"><?php echo $event->post_title; ?></a></h4>
</td>
</tr>

View File

@@ -70,6 +70,12 @@ endif;
if ( $usecolumns == null || in_array( 'time', $usecolumns ) )
echo '<th class="data-time">' . __( 'Time/Results', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'league', $usecolumns ) )
echo '<th class="data-league">' . __( 'League', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'season', $usecolumns ) )
echo '<th class="data-season">' . __( 'Season', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'venue', $usecolumns ) )
echo '<th class="data-venue">' . __( 'Venue', 'sportspress' ) . '</th>';
@@ -162,6 +168,24 @@ endif;
echo '</a></td>';
endif;
if ( $usecolumns == null || in_array( 'league', $usecolumns ) ):
echo '<td class="data-league">';
$leagues = get_the_terms( $event->ID, 'sp_league' );
foreach ( $leagues as $league ):
echo $league->name;
endforeach;
echo '</td>';
endif;
if ( $usecolumns == null || in_array( 'season', $usecolumns ) ):
echo '<td class="data-season">';
$seasons = get_the_terms( $event->ID, 'sp_season' );
foreach ( $seasons as $season ):
echo $season->name;
endforeach;
echo '</td>';
endif;
if ( $usecolumns == null || in_array( 'venue', $usecolumns ) ):
echo '<td class="data-venue">';
if ( $link_venues ):