Display event team logos via template

This commit is contained in:
Brian Miyaji
2014-10-21 02:28:59 +11:00
parent cf17257881
commit 183ce65dda
3 changed files with 29 additions and 17 deletions

View File

@@ -7,9 +7,10 @@
}
/* Title */
.sp-event-teams {
.sp-event-logos {
margin-top: 0.5em;
margin-bottom: 0.5em;
text-align: center;
}
/* Data Tables */

View File

@@ -70,6 +70,20 @@ if ( ! function_exists( 'sportspress_taxonomy_archive_description' ) ) {
/** Single Event ********************************************************/
if ( ! function_exists( 'sportspress_output_event_logos' ) ) {
/**
* Output the event logos.
*
* @access public
* @subpackage Event/Logos
* @return void
*/
function sportspress_output_event_logos() {
sp_get_template( 'event-logos.php' );
}
}
if ( ! function_exists( 'sportspress_output_event_video' ) ) {
/**

View File

@@ -31,6 +31,7 @@ add_action( 'get_the_generator_xhtml', 'sp_generator_tag', 10, 2 );
* @see sportspress_output_event_venue()
* @see sportspress_output_event_performance()
*/
add_action( 'sportspress_single_event_content', 'sportspress_output_event_logos', 5 );
add_action( 'sportspress_single_event_content', 'sportspress_output_event_video', 10 );
add_action( 'sportspress_single_event_content', 'sportspress_output_event_results', 20 );
add_action( 'sportspress_single_event_content', 'sportspress_output_event_details', 30 );
@@ -119,22 +120,6 @@ function sportspress_the_title( $title, $id = null ) {
if ( $role ):
$title = '<strong>' . $role->name . '</strong> ' . $title;
endif;
elseif ( is_singular( 'sp_event' ) && get_option( 'sportspress_event_show_logos', 'yes' ) == 'yes' ):
$teams = get_post_meta( $id, 'sp_team' );
$teams = array_filter( $teams );
if ( $teams ):
$team_logos = array();
foreach ( $teams as $team ):
$team_logos[] = get_the_post_thumbnail( $team, 'sportspress-fit-icon' );
endforeach;
$team_logos = array_filter( $team_logos );
if ( ! empty( $team_logos ) ):
$title .= '<div class="sp-event-teams">';
$delimiter = get_option( 'sportspress_event_teams_delimiter', 'vs' );
$title .= implode( ' ' . $delimiter . ' ', $team_logos );
$title .= '</div>';
endif;
endif;
endif;
endif;
@@ -252,6 +237,18 @@ function sportspress_team_permalink( $permalink, $post ) {
}
add_filter( 'post_type_link', 'sportspress_team_permalink', 10, 2 );
function sportspress_abbreviate_team( $title, $id = null ) {
if ( ! is_admin() && 'sp_team' == get_post_type( $id ) && get_option( 'sportspress_abbreviate_teams', 'yes' ) == 'yes' ):
if ( in_the_loop() && get_the_ID() == $id ) return $title;
$abbreviation = get_post_meta( $id, 'sp_abbreviation', true );
if ( ! empty( $abbreviation ) ):
return $abbreviation;
endif;
endif;
return $title;
}
add_filter( 'the_title', 'sportspress_abbreviate_team', 10, 2 );
function sportspress_no_terms_links( $term_list, $taxonomy ) {
if ( in_array( $taxonomy, array( 'sp_league', 'sp_season' ) ) )