Fix event results display
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
function sportspress_post_thumbnail_html( $html, $post_id, $post_thumbnail_id, $size, $attr ) {
|
function sportspress_post_thumbnail_html( $html, $post_id, $post_thumbnail_id, $size, $attr ) {
|
||||||
if( empty ( $html ) && in_array( get_post_type( $post_id ), array( 'sp_team', 'sp_tournament' ) ) ) {
|
if( empty ( $html ) && get_post_type( $post_id ) == 'sp_team' ) {
|
||||||
$parents = get_post_ancestors( $post_id );
|
$parents = get_post_ancestors( $post_id );
|
||||||
foreach ( $parents as $parent ) {
|
foreach ( $parents as $parent ) {
|
||||||
if( has_post_thumbnail( $parent ) ) {
|
if( has_post_thumbnail( $parent ) ) {
|
||||||
|
|||||||
@@ -13,10 +13,12 @@ function sportspress_default_event_content( $content ) {
|
|||||||
$results = sportspress_event_results();
|
$results = sportspress_event_results();
|
||||||
$players = sportspress_event_players();
|
$players = sportspress_event_players();
|
||||||
$staff = sportspress_event_staff();
|
$staff = sportspress_event_staff();
|
||||||
if ( is_array( $results ) && array_filter( $results, 'array_filter' ) )
|
if ( $results ):
|
||||||
return $results . $details . $players . $staff . $content;
|
$content = $results . $details . $players . $staff . $content;
|
||||||
$venue = sportspress_event_venue();
|
else:
|
||||||
$content = $details . $venue . $players . $staff . $content;
|
$venue = sportspress_event_venue();
|
||||||
|
$content = $details . $venue . $players . $staff . $content;
|
||||||
|
endif;
|
||||||
endif;
|
endif;
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ if ( !function_exists( 'sportspress_event_results' ) ) {
|
|||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
|
if ( empty( array_filter( $results, 'array_filter' ) ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
foreach( $results as $team_id => $result ):
|
foreach( $results as $team_id => $result ):
|
||||||
if ( sportspress_array_value( $result, 'outcome', '-1' ) != '-1' ):
|
if ( sportspress_array_value( $result, 'outcome', '-1' ) != '-1' ):
|
||||||
|
|
||||||
@@ -43,7 +46,11 @@ if ( !function_exists( 'sportspress_event_results' ) ) {
|
|||||||
endif;
|
endif;
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
||||||
if ( ! empty( $table_rows ) ):
|
if ( empty( $table_rows ) ):
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
$output .= '<h3>' . __( 'Results', 'sportspress' ) . '</h3>';
|
$output .= '<h3>' . __( 'Results', 'sportspress' ) . '</h3>';
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ if ( !function_exists( 'sportspress_event_venue' ) ) {
|
|||||||
$longitude = sportspress_array_value( $term_meta, 'sp_longitude', 0 );
|
$longitude = sportspress_array_value( $term_meta, 'sp_longitude', 0 );
|
||||||
|
|
||||||
$output .= '<h3>' . __( 'Venue', 'sportspress' ) . '</h3>';
|
$output .= '<h3>' . __( 'Venue', 'sportspress' ) . '</h3>';
|
||||||
$output .= '<p>' . $venue->name . '<br><small>' . $address . '</small></p>';
|
$output .= '<p><a href="' . get_term_link( $t_id, 'sp_venue' ) . '">' . $venue->name . '</a><br><small>' . $address . '</small></p>';
|
||||||
if ( $latitude != null && $longitude != null )
|
if ( $latitude != null && $longitude != null )
|
||||||
$output .= '<div class="sp-google-map" data-address="' . $address . '" data-latitude="' . $latitude . '" data-longitude="' . $longitude . '"></div>';
|
$output .= '<div class="sp-google-map" data-address="' . $address . '" data-latitude="' . $latitude . '" data-longitude="' . $longitude . '"></div>';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user