Add option to select if calendar links to teams

This commit is contained in:
Brian Miyaji
2014-05-16 21:54:32 +10:00
parent 38a4a321ba
commit 8072f8c57f
4 changed files with 21 additions and 3 deletions

View File

@@ -32,7 +32,7 @@ class SP_Meta_Box_Event_Teams {
'name' => 'sp_team[]',
'class' => 'sportspress-pages',
'show_option_none' => sprintf( __( '— None —', 'sportspress' ), 'Team' ),
'selected' => $team
'selected' => $team,
);
wp_dropdown_pages( $args );
?>

View File

@@ -101,6 +101,14 @@ class SP_Settings_Events extends SP_Settings_Page {
array( 'title' => __( 'Calendars', 'sportspress' ), 'type' => 'title', 'id' => 'calendar_options' ),
array(
'title' => __( 'Teams', 'sportspress' ),
'desc' => __( 'Link teams', 'sportspress' ),
'id' => 'sportspress_calendar_link_teams',
'default' => 'no',
'type' => 'checkbox',
),
array(
'title' => __( 'Pagination', 'sportspress' ),
'desc' => __( 'Paginate', 'sportspress' ),

View File

@@ -14,6 +14,7 @@ $primary_result = get_option( 'sportspress_primary_result', null );
$defaults = array(
'status' => 'default',
'number' => -1,
'link_teams' => get_option( 'sportspress_calendar_link_teams', 'no' ) == 'yes' ? true : false,
'paginated' => get_option( 'sportspress_calendar_paginated', 'yes' ) == 'yes' ? true : false,
'rows' => get_option( 'sportspress_calendar_rows', 10 ),
'order' => 'default',
@@ -57,7 +58,11 @@ if ( isset( $columns ) )
if ( ! has_post_thumbnail ( $team ) )
continue;
$j++;
if ( $link_teams ):
$logo = '<a href="' . get_post_permalink( $team ) . '" title="' . get_the_title( $team ) . '">' . get_the_post_thumbnail( $team, 'sportspress-fit-icon', array( 'class' => 'team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) ) ) . '</a>';
else:
$logo = get_the_post_thumbnail( $team, 'sportspress-fit-icon', array( 'class' => 'team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) ) );
endif;
$logos[] = $logo;
$team_results = sp_array_value( $results, $team, null );

View File

@@ -14,6 +14,7 @@ $primary_result = get_option( 'sportspress_primary_result', null );
$defaults = array(
'status' => 'default',
'number' => -1,
'link_teams' => get_option( 'sportspress_calendar_link_teams', 'no' ) == 'yes' ? true : false,
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
'responsive' => get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false,
'paginated' => get_option( 'sportspress_calendar_paginated', 'yes' ) == 'yes' ? true : false,
@@ -93,7 +94,11 @@ if ( isset( $columns ) )
endif;
endif;
if ( $link_teams ):
$teams_output .= '<a href="' . get_post_permalink( $team ) . '">' . $name . '</a>';
else:
$teams_output .= $name;
endif;
if ( $team_result != null ):
$main_results[] = $team_result;