File: /var/www/html/shootinschool/wp-content/themes/shootinschool/sportspress/event-logos.php
<?php
/**
* Event Logos
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 2.6.5
*/
if (!defined('ABSPATH')) exit; // Exit if accessed directly
$eventResultAsHeader = get_post_meta(get_the_ID(), 'event_as_header', false);
if (get_option('sportspress_event_show_logos', 'yes') === 'no' ) return;
if($eventResultAsHeader != null && $eventResultAsHeader[0] == "on") return;
if (!isset($id)) {
$id = get_the_ID();
}
?>
<div class="stm-next-match-units">
<?php if(!is_layout("sccr")): ?>
<?php
/*Check if two team exist in derby*/
$teams = get_post_meta($id, 'sp_team', false);
if (count($teams) > 1): ?>
<?php
/* Get league names */
$leagues = wp_get_post_terms(get_the_id(), 'sp_league');
$leagues_names = array();
if (!empty($leagues)) {
foreach ($leagues as $league) {
$leagues_names[] = $league->name;
}
}
/*Get venue name*/
$venue = wp_get_post_terms(get_the_id(), 'sp_venue');
$venue_name = '';
if(!empty($venue) and !is_wp_error($venue)) {
$venue_name = $venue[0]->name;
}
/*Get AF data*/
//if(is_layout("af") || is_layout("baseball")){
$teams = array_filter( $teams, 'sp_filter_positive' );
$team_1_id = $teams[0];
$team_2_id = $teams[1];
$city_1 = wp_get_post_terms($team_1_id, 'sp_venue');
$city_2 = wp_get_post_terms($team_2_id, 'sp_venue');
$team_results = get_post_meta(get_the_ID(), 'sp_results', false);
$permalink = get_post_permalink( get_the_ID(), false, true );
$results = get_post_meta( get_the_ID(), 'sp_results', true );
$point_system = splash_get_sportpress_points_system();
//}
?>
<div class="stm-next-match-unit">
<div class="stm-next-match-time">
<?php
$date = new DateTime(get_the_time('Y/m/d H:i:s'));
if ($date) {
$date_show = get_post_time(sp_date_format() . ' - ' . sp_time_format(), false, get_the_ID(), true);
$date = $date->format('Y-m-d H:i:s');
}
?>
<time class="heading-font" datetime="<?php echo esc_attr($date) ?>"
data-countdown="<?php echo esc_attr(str_replace("-", "/", $date)) ?>"></time>
</div>
<div class="stm-next-match-main-meta">
<div class="stm-next-matches_bg"
style="background-image: url(<?php echo esc_url(get_theme_mod('sp_event_bg')); ?>);"></div>
<div class="stm-next-match-opponents-units">
<div class="stm-next-match-opponents <?php if(empty($team_results[0][$team_1_id][$point_system]) and empty($team_results[0][$team_2_id][$point_system])) echo "stm_event_future "; ?>">
<?php
/*Get teams meta*/
$imgSize = (is_layout("baseball")) ? 'full' : 'stm-200-200';
$team_1_title = get_the_title($teams[0]);
$team_1_image = splash_get_thumbnail_url($teams[0],'', $imgSize);
$team_1_url = get_permalink($teams[0]);
$team_2_title = get_the_title($teams[1]);
$team_2_image = splash_get_thumbnail_url($teams[1], '', $imgSize);
$team_2_url = get_permalink($teams[1]);
?>
<div class="stm-command">
<?php if(!empty($team_1_image)): ?>
<div class="stm-command-logo">
<a href="<?php echo esc_url($team_1_url); ?>">
<?php
if(is_layout("af")):
$postMeta = get_post_meta($teams[0], 'team_helm_image');
$attachImg = ($postMeta) ? wp_get_attachment_image_src($postMeta[0], 'full') : 0;
?>
<img src="<?php echo (count($attachImg) > 0) ? esc_url($attachImg[0]) : ""; ?>" />
<?php endif; ?>
<img src="<?php echo esc_url($team_1_image); ?>" />
</a>
</div>
<?php endif; ?>
<?php if(!is_layout("af") && !is_layout("baseball")) :?>
<div class="stm-command-title">
<h4>
<a href="<?php echo esc_url($team_1_url); ?>">
<?php echo esc_attr($team_1_title); ?>
</a>
</h4>
</div>
<?php endif; ?>
</div>
<?php if(!is_layout("af") && !is_layout("baseball")): ?>
<?php if(!empty($team_results[0][$team_1_id])): ?>
<?php if(isset($team_results[0][$team_1_id]['outcome']) and !empty($team_results[0][$team_1_id]['outcome'][0])): ?>
<div class="stm-command-results">
<span>
<?php echo esc_attr($team_results[0][$team_1_id][$point_system]); ?> : <?php echo esc_attr($team_results[0][$team_2_id][$point_system]); ?>
</span>
</div>
<?php endif; ?>
<?php else: ?>
<div class="stm-command-vs"><span><?php esc_html_e('vs', 'splash'); ?></span></div>
<?php endif; ?>
<?php else : ?>
<div class="stm-teams-info heading-font">
<div class="stm-command-title-left">
<?php if(is_layout("af") || is_layout("baseball")) :?>
<span class="stm-team-city"><?php echo $city_1[0]->name;?></span>
<?php endif; ?>
<h4>
<a href="<?php echo esc_url($team_1_url); ?>">
<?php echo esc_attr($team_1_title); ?>
</a>
</h4>
<?php if(is_layout('baseball') && !empty($team_results[0]) && !empty($team_results[0][$team_1_id]) && isset($team_results[0][$team_1_id]['outcome']) and !empty($team_results[0][$team_1_id]['outcome'][0])): ?>
<div class="<?php echo ($team_results[0][$team_1_id]['outcome'][0] == 'win') ? 'stm-latest-result-win-label' : 'stm-latest-result-lose-label';?> heading-font"><?php esc_html_e($team_results[0][$team_1_id]['outcome'][0], 'splash') ?></div>
<?php endif; ?>
</div>
<div class="stm-team-results-outer">
<?php if(!empty($team_results[0])): ?>
<?php if(!empty($team_results[0][$team_1_id]) and !empty($team_results[0][$team_2_id])): ?>
<?php if(isset($team_results[0][$team_1_id][$point_system]) and isset($team_results[0][$team_2_id][$point_system])): ?>
<?php if(empty($team_results[0][$team_1_id][$point_system]) and empty($team_results[0][$team_2_id][$point_system])): ?>
<div class="stm-latest-result_result"><?php esc_html_e('VS', 'splash'); ?></div>
<?php else: ?>
<div class="stm-latest-result_result">
<?php if(!is_layout('baseball')) : ?>
<span class="stm-res-left">
<?php if(!empty($team_results[0][$team_1_id])): ?>
<?php if(isset($team_results[0][$team_1_id]['outcome']) and !empty($team_results[0][$team_1_id]['outcome'][0])): ?>
<span class="<?php echo ($team_results[0][$team_1_id]['outcome'][0] == 'win') ? 'stm-win' : 'stm-lose';?>"><?php echo esc_attr($team_results[0][$team_1_id][$point_system]); ?></span>
<div class="<?php echo ($team_results[0][$team_1_id]['outcome'][0] == 'win') ? 'stm-latest-result-win-label' : 'stm-latest-result-lose-label';?> <?php echo (is_layout("af") || is_layout("baseball")) ? "heading-font" : "normal-font"?>"><?php esc_html_e($team_results[0][$team_1_id]['outcome'][0], 'splash') ?></div>
<?php endif; ?>
<?php endif; ?>
</span>
<span class="stm-res-right">
<?php if(!empty($team_results[0])): ?>
<?php if(!empty($team_results[0][$team_2_id])): ?>
<?php if(isset($team_results[0][$team_2_id]['outcome']) and !empty($team_results[0][$team_2_id]['outcome'][0])): ?>
<span class="<?php echo ($team_results[0][$team_2_id]['outcome'][0] == 'win') ? 'stm-win' : 'stm-lose';?>"><?php echo esc_attr($team_results[0][$team_2_id][$point_system]); ?></span>
<div class="<?php echo ($team_results[0][$team_2_id]['outcome'][0] == 'win') ? 'stm-latest-result-win-label' : 'stm-latest-result-lose-label';?> <?php echo (is_layout("af") || is_layout("baseball")) ? "heading-font" : "normal-font"?>"><?php esc_html_e($team_results[0][$team_2_id]['outcome'][0], 'splash') ?></div>
<?php else: ?>
<div class="stm-latest-result-lose-label"><?php esc_html_e('- -', 'splash') ?></div>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
</span>
<?php else: ?>
<span class="stm-res-outer">
<?php if(!empty($team_results[0][$team_1_id])): ?>
<?php if(isset($team_results[0][$team_1_id]['outcome']) and !empty($team_results[0][$team_1_id]['outcome'][0])): ?>
<span class="<?php echo ($team_results[0][$team_1_id]['outcome'][0] == 'win') ? 'stm-win' : 'stm-lose';?>">
<?php echo esc_attr($team_results[0][$team_1_id][$point_system]); ?> : <?php echo esc_attr($team_results[0][$team_2_id][$point_system]); ?>
</span>
<?php endif; ?>
<?php endif; ?>
</span>
<?php endif; ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php else: ?>
<div class="stm-latest-result_result"><?php esc_html_e('- VS -', 'splash'); ?></div>
<?php endif; ?>
</div>
<div class="stm-command-title-right">
<?php if(is_layout("af") || is_layout("baseball")) :?>
<span class="stm-team-city"><?php echo $city_2[0]->name;?></span>
<?php endif; ?>
<h4>
<a href="<?php echo esc_url($team_2_url); ?>">
<?php echo esc_attr($team_2_title); ?>
</a>
</h4>
<?php if(is_layout('baseball') && !empty($team_results[0]) && !empty($team_results[0][$team_2_id]) && isset($team_results[0][$team_2_id]['outcome']) and !empty($team_results[0][$team_2_id]['outcome'][0])): ?>
<div class="<?php echo ($team_results[0][$team_2_id]['outcome'][0] == 'win') ? 'stm-latest-result-win-label' : 'stm-latest-result-lose-label';?> heading-font"><?php esc_html_e($team_results[0][$team_2_id]['outcome'][0], 'splash') ?></div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<div class="stm-command stm-command-right">
<?php if(!is_layout("af") && !is_layout("baseball")) :?>
<div class="stm-command-title">
<h4>
<a href="<?php echo esc_url($team_2_url); ?>">
<?php echo esc_attr($team_2_title); ?>
</a>
</h4>
</div>
<?php endif; ?>
<?php if(!empty($team_2_image)): ?>
<div class="stm-command-logo">
<a href="<?php echo esc_url($team_2_url); ?>">
<?php
if(is_layout("af")):
$postMeta = get_post_meta($teams[1], 'team_helm_image');
$attachImg = wp_get_attachment_image_src($postMeta[0], 'full');
?>
<img src="<?php echo esc_url($attachImg[0]); ?>" /><?php endif; ?>
<img src="<?php echo esc_url($team_2_image); ?>" />
</a>
</div>
<?php endif; ?>
</div>
</div>
</div>
<?php if(is_layout("af") || is_layout("baseball")) echo "<div class='stm-next-match-info-wrapp'>"; ?>
<div class="stm-next-match-info <?php echo (is_layout("bb")) ? "heading-font" : "normal-font"?>">
<?php echo esc_attr(implode(',', $leagues_names) . ' ' . $date_show); ?>
</div>
<?php if(!empty($venue_name)): ?>
<div class="stm-next-match-venue <?php echo (is_layout("bb")) ? "heading-font" : "normal-font"?>">
<?php echo esc_attr($venue_name); ?>
</div>
<?php endif; ?>
<?php if(is_layout("af") || is_layout("baseball")) echo "</div>"; ?>
</div>
</div>
<?php endif; /*Two team exists*/ ?>
<?php else:
/**
* Created by PhpStorm.
* User: NDimaA
* Date: 16.02.2017
* Time: 14:36
*/
$teams = get_post_meta($id, 'sp_team', false);
/* Get league names */
$leagues = wp_get_post_terms(get_the_id(), 'sp_league');
$leagues_names = array();
if (!empty($leagues)) {
foreach ($leagues as $league) {
$leagues_names[] = $league->name;
}
}
/*Get venue name*/
$venue = wp_get_post_terms(get_the_id(), 'sp_venue');
$venue_name = '';
if(!empty($venue) and !is_wp_error($venue)) {
$venue_name = $venue[0]->name;
}
$performance = sp_get_performance(get_the_ID());
$team_1_id = $teams[0];
$team_2_id = $teams[1];
$city_1 = wp_get_post_terms($team_1_id, 'sp_venue');
$city_2 = wp_get_post_terms($team_2_id, 'sp_venue');
$team_results = get_post_meta(get_the_ID(), 'sp_results', false);
$permalink = get_post_permalink( get_the_ID(), false, true );
$results = get_post_meta( get_the_ID(), 'sp_results', true );
$point_system = splash_get_sportpress_points_system();
$sportspress_primary_result = get_option( 'sportspress_primary_result', null );
if( !empty( $sportspress_primary_result ) )
$goals = $sportspress_primary_result;
else
$goals = "goals" ;
?>
<div class="container">
<div class="stm-event-results-as-header-wrapper <?php if(empty($team_results[0][$team_1_id]['outcome'][0])) echo "stm-event-feature"; ?>">
<div class="fixture_detail clearfix">
<div class="command_left">
<div class="command_info">
<div class="logo">
<a href="<?php echo esc_url( get_the_permalink($team_1_id) ); ?>"><?php echo get_the_post_thumbnail($team_1_id, "team_logo"); ?></a>
</div>
<?php if(!empty($team_results[0][$team_1_id])): ?>
<?php if(isset($team_results[0][$team_1_id]['outcome']) and !empty($team_results[0][$team_1_id]['outcome'][0])): ?>
<div class="score heading-font"><?php echo esc_attr($team_results[0][$team_1_id][$point_system])?></div>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="goals">
<h2>
<a href="<?php echo esc_url( get_the_permalink($team_1_id) ); ?>"><?php echo esc_html( get_the_title( $team_1_id ) ); ?></a>
</h2>
<?php if(!empty($team_results[0])): ?>
<?php if(!empty($team_results[0][$team_1_id])): ?>
<?php if(isset($team_results[0][$team_1_id]['outcome']) and !empty($team_results[0][$team_1_id]['outcome'][0])): ?>
<?php if($team_results[0][$team_1_id]['outcome'][0] == 'win'): ?>
<div class="stm-latest-result-win-label heading-font"><?php esc_html_e('win', 'splash') ?></div>
<?php else: ?>
<div class="stm-latest-result-lose-label heading-font"><?php esc_html_e($team_results[0][$team_1_id]['outcome'][0], 'splash') ?></div>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<ul class="players">
<?php
if(!empty($performance[$team_1_id])) {
foreach ($performance[$team_1_id] as $player_id => $player) {
if (is_layout("af")) {
$goalsList = 'td';
$title = esc_html__('touchdown(s)', 'splash');
} else {
$goalsList = $goals;
$title = esc_html__('goal(s)', 'splash');
}
if (isset($player[$goalsList])) {
if ($player[$goalsList] >= 1) {
?>
<li>
<?php echo esc_html(get_the_title($player_id)) ?> -
<span><?php echo esc_html($player[$goalsList]) . ' ' . $title; ?></span>
</li>
<?php
}
}
}
}
?>
</ul>
</div>
</div>
<?php if(empty($team_results[0][$team_1_id]['outcome'][0])): ?>
<div class="stm-event-vs heading-font">vs</div>
<?php endif; ?>
<div class="command_right">
<div class="command_info">
<div class="logo">
<a href="<?php echo esc_url( get_the_permalink($team_2_id) ); ?>"><?php echo get_the_post_thumbnail($team_2_id, "team_logo"); ?></a>
</div>
<?php if(!empty($team_results[0][$team_2_id])): ?>
<?php if(isset($team_results[0][$team_2_id]['outcome']) and !empty($team_results[0][$team_2_id]['outcome'][0])): ?>
<span class="score heading-font"><?php echo esc_attr($team_results[0][$team_2_id][$point_system])?></span>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="goals">
<h2>
<a href="<?php echo esc_url( get_the_permalink($team_2_id) ); ?>"><?php echo esc_html( get_the_title( $team_2_id ) ); ?></a>
</h2>
<?php if(!empty($team_results[0])): ?>
<?php if(!empty($team_results[0][$team_2_id])): ?>
<?php if(isset($team_results[0][$team_2_id]['outcome']) and !empty($team_results[0][$team_2_id]['outcome'][0])): ?>
<?php if($team_results[0][$team_2_id]['outcome'][0] == 'win'): ?>
<div class="stm-latest-result-win-label heading-font"><?php esc_html_e('win', 'splash') ?></div>
<?php else: ?>
<div class="stm-latest-result-lose-label heading-font"><?php esc_html_e($team_results[0][$team_2_id]['outcome'][0], 'splash') ?></div>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<ul class="players">
<?php
if(!empty($performance[$team_2_id])) {
foreach ($performance[$team_2_id] as $player_id => $player) {
if (is_layout("af")) {
$goalsList = 'td';
$title = esc_html__('touchdown(s)', 'splash');
} else {
$goalsList = $goals;
$title = esc_html__('goal(s)', 'splash');
}
if (isset($player[$goalsList])) {
if ($player[$goalsList] >= 1) {
?>
<li>
<?php echo esc_html(get_the_title($player_id)) ?> -
<span><?php echo esc_html($player[$goalsList]) . ' ' . $title; ?></span>
</li>
<?php
}
}
}
}
?>
</ul>
</div>
</div>
</div>
<?php
$date = get_the_time( get_option('date_format'), get_the_ID() );
$time = get_the_time(get_option('time_format'), get_the_ID());
?>
<div class="fixture_info_publish">
<div class="stm-event-as-header-date-publish-wrapp">
<div class="stm-flex-column">
<div class="date"><?php echo esc_html( $date ); ?> | <?php echo esc_html($time); ?></div>
</div>
<div class="venue"><?php echo esc_html( $venue_name ); ?></div>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>