Add option to display venue in event blocks close #90

This commit is contained in:
Brian Miyaji
2014-12-10 10:13:02 +11:00
parent fdca8e72b3
commit c9858f777b
2 changed files with 12 additions and 0 deletions

View File

@@ -246,6 +246,14 @@ class SP_Settings_Events extends SP_Settings_Page {
'id' => 'sportspress_event_blocks_show_season',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => '',
),
array(
'desc' => __( 'Display venue', 'sportspress' ),
'id' => 'sportspress_event_blocks_show_venue',
'default' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'end',
),

View File

@@ -25,6 +25,7 @@ $defaults = array(
'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,
'show_venue' => get_option( 'sportspress_event_blocks_show_venue', 'no' ) == 'yes' ? true : false,
);
extract( $defaults, EXTR_SKIP );
@@ -114,6 +115,9 @@ if ( $id ) {
<?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; ?>
<?php if ( $show_venue ): $venues = get_the_terms( $event, 'sp_venue' ); if ( $venues ): $venue = array_shift( $venues ); ?>
<div class="event-venue"><?php echo $venue->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>