Clean up spaces, tabs, indentation, and bracket formatting
This commit is contained in:
@@ -2,79 +2,81 @@
|
||||
/**
|
||||
* Birthdays
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress_Birthdays
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress_Birthdays
|
||||
* @version 2.7.4
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
$html5 = current_theme_supports( 'html5', 'gallery' );
|
||||
$html5 = current_theme_supports( 'html5', 'gallery' );
|
||||
$defaults = array(
|
||||
'date' => 'day',
|
||||
'itemtag' => 'dl',
|
||||
'icontag' => 'dt',
|
||||
'captiontag' => 'dd',
|
||||
'size' => 'sportspress-fit-medium',
|
||||
'birthday_format' => 'birthday',
|
||||
'date' => 'day',
|
||||
'itemtag' => 'dl',
|
||||
'icontag' => 'dt',
|
||||
'captiontag' => 'dd',
|
||||
'size' => 'sportspress-fit-medium',
|
||||
'birthday_format' => 'birthday',
|
||||
'show_player_birthday' => get_option( 'sportspress_player_show_birthday', 'no' ) == 'yes' ? true : false,
|
||||
'show_staff_birthday' => get_option( 'sportspress_staff_show_birthday', 'no' ) == 'yes' ? true : false,
|
||||
'link_players' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
|
||||
'link_staff' => get_option( 'sportspress_link_staff', 'yes' ) == 'yes' ? true : false,
|
||||
'show_staff_birthday' => get_option( 'sportspress_staff_show_birthday', 'no' ) == 'yes' ? true : false,
|
||||
'link_players' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
|
||||
'link_staff' => get_option( 'sportspress_link_staff', 'yes' ) == 'yes' ? true : false,
|
||||
);
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
|
||||
$args = array(
|
||||
'post_type' => array( 'sp_player', 'sp_staff' ),
|
||||
'numberposts' => -1,
|
||||
'post_type' => array( 'sp_player', 'sp_staff' ),
|
||||
'numberposts' => -1,
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'date',
|
||||
'order' => 'ASC',
|
||||
'monthnum' => date('n'),
|
||||
'orderby' => 'date',
|
||||
'order' => 'ASC',
|
||||
'monthnum' => date( 'n' ),
|
||||
);
|
||||
|
||||
if ( $date == 'day' ) {
|
||||
$args['day'] = date('j');
|
||||
$args['day'] = date( 'j' );
|
||||
}
|
||||
|
||||
if ( $date == 'week' ) {
|
||||
unset ( $args['monthnum'] );
|
||||
unset( $args['monthnum'] );
|
||||
$args['date_query'] = array(
|
||||
array(
|
||||
'month' => date('n'),
|
||||
'day' => date('j'),
|
||||
),
|
||||
array(
|
||||
'month' => date( "n", strtotime( "+1 day" ) ),
|
||||
'day' => date( "j", strtotime( "+1 day" ) ),
|
||||
),
|
||||
array(
|
||||
'month' => date( "n", strtotime( "+2 days" ) ),
|
||||
'day' => date( "j", strtotime( "+2 days" ) ),
|
||||
),
|
||||
array(
|
||||
'month' => date( "n", strtotime( "+3 days" ) ),
|
||||
'day' => date( "j", strtotime( "+3 days" ) ),
|
||||
),
|
||||
array(
|
||||
'month' => date( "n", strtotime( "+4 days" ) ),
|
||||
'day' => date( "j", strtotime( "+4 days" ) ),
|
||||
),
|
||||
array(
|
||||
'month' => date( "n", strtotime( "+5 days" ) ),
|
||||
'day' => date( "j", strtotime( "+5 days" ) ),
|
||||
),
|
||||
array(
|
||||
'month' => date( "n", strtotime( "+6 days" ) ),
|
||||
'day' => date( "j", strtotime( "+6 days" ) ),
|
||||
),
|
||||
array(
|
||||
'month' => date( "n", strtotime( "+1 week" ) ),
|
||||
'day' => date( "j", strtotime( "+1 week" ) ),
|
||||
),
|
||||
'relation' => 'OR',
|
||||
);
|
||||
array(
|
||||
'month' => date( 'n' ),
|
||||
'day' => date( 'j' ),
|
||||
),
|
||||
array(
|
||||
'month' => date( 'n', strtotime( '+1 day' ) ),
|
||||
'day' => date( 'j', strtotime( '+1 day' ) ),
|
||||
),
|
||||
array(
|
||||
'month' => date( 'n', strtotime( '+2 days' ) ),
|
||||
'day' => date( 'j', strtotime( '+2 days' ) ),
|
||||
),
|
||||
array(
|
||||
'month' => date( 'n', strtotime( '+3 days' ) ),
|
||||
'day' => date( 'j', strtotime( '+3 days' ) ),
|
||||
),
|
||||
array(
|
||||
'month' => date( 'n', strtotime( '+4 days' ) ),
|
||||
'day' => date( 'j', strtotime( '+4 days' ) ),
|
||||
),
|
||||
array(
|
||||
'month' => date( 'n', strtotime( '+5 days' ) ),
|
||||
'day' => date( 'j', strtotime( '+5 days' ) ),
|
||||
),
|
||||
array(
|
||||
'month' => date( 'n', strtotime( '+6 days' ) ),
|
||||
'day' => date( 'j', strtotime( '+6 days' ) ),
|
||||
),
|
||||
array(
|
||||
'month' => date( 'n', strtotime( '+1 week' ) ),
|
||||
'day' => date( 'j', strtotime( '+1 week' ) ),
|
||||
),
|
||||
'relation' => 'OR',
|
||||
);
|
||||
}
|
||||
|
||||
$posts = get_posts( $args );
|
||||
@@ -83,14 +85,14 @@ foreach ( $posts as $post ) {
|
||||
echo '<div class="sp-template sp-template-birthdays sp-template-birthday-gallery sp-template-gallery">';
|
||||
|
||||
if ( 'sp_staff' == $post->post_type ) {
|
||||
$link_posts = $link_staff;
|
||||
$link_posts = $link_staff;
|
||||
$show_birthday = $show_staff_birthday;
|
||||
} else {
|
||||
$link_posts = $link_players;
|
||||
$link_posts = $link_players;
|
||||
$show_birthday = $show_player_birthday;
|
||||
}
|
||||
|
||||
$birthday = get_the_date( get_option( 'date_format') , $post->ID );
|
||||
$birthday = get_the_date( get_option( 'date_format' ), $post->ID );
|
||||
|
||||
$heading = null;
|
||||
if ( ( $show_birthday || 'birthday' == $birthday_format ) && $birthday && 'hide' != $birthday_format ) {
|
||||
@@ -98,31 +100,34 @@ foreach ( $posts as $post ) {
|
||||
}
|
||||
if ( 'age' == $birthday_format && $birthday ) {
|
||||
$sp_birthdays = new SportsPress_Birthdays();
|
||||
$age = $sp_birthdays->get_age( get_the_date( 'm-d-Y', $post->ID ) );
|
||||
$heading = '<h4 class="sp-table-caption">' . $age . '</h4>';
|
||||
$age = $sp_birthdays->get_age( get_the_date( 'm-d-Y', $post->ID ) );
|
||||
$heading = '<h4 class="sp-table-caption">' . $age . '</h4>';
|
||||
}
|
||||
if ( 'birthdayage' == $birthday_format && $birthday ) {
|
||||
$sp_birthdays = new SportsPress_Birthdays();
|
||||
$age = $sp_birthdays->get_age( get_the_date( 'm-d-Y', $post->ID ) );
|
||||
$heading = '<h4 class="sp-table-caption">' . $birthday . ' (' . $age . ')</h4>';
|
||||
$age = $sp_birthdays->get_age( get_the_date( 'm-d-Y', $post->ID ) );
|
||||
$heading = '<h4 class="sp-table-caption">' . $birthday . ' (' . $age . ')</h4>';
|
||||
}
|
||||
echo $heading;
|
||||
|
||||
|
||||
echo '<div class="gallery">';
|
||||
|
||||
$caption = $post->post_title;
|
||||
$caption = trim( $caption );
|
||||
|
||||
sp_get_template( 'player-gallery-thumbnail.php', array(
|
||||
'id' => $post->ID,
|
||||
'itemtag' => $itemtag,
|
||||
'icontag' => $icontag,
|
||||
'captiontag' => $captiontag,
|
||||
'caption' => $caption,
|
||||
'size' => $size,
|
||||
'link_posts' => $link_posts,
|
||||
) );
|
||||
sp_get_template(
|
||||
'player-gallery-thumbnail.php',
|
||||
array(
|
||||
'id' => $post->ID,
|
||||
'itemtag' => $itemtag,
|
||||
'icontag' => $icontag,
|
||||
'captiontag' => $captiontag,
|
||||
'caption' => $caption,
|
||||
'size' => $size,
|
||||
'link_posts' => $link_posts,
|
||||
)
|
||||
);
|
||||
|
||||
echo '<br style="clear: both;" />';
|
||||
echo '<br style="clear: both;" />';
|
||||
echo "</div></div>\n";
|
||||
}
|
||||
|
||||
@@ -2,49 +2,55 @@
|
||||
/**
|
||||
* Countdown
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.7.9
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
$defaults = array(
|
||||
'team' => null,
|
||||
'calendar' => null,
|
||||
'order' => null,
|
||||
'orderby' => null,
|
||||
'league' => null,
|
||||
'season' => null,
|
||||
'id' => null,
|
||||
'title' => null,
|
||||
'live' => get_option( 'sportspress_enable_live_countdowns', 'yes' ) == 'yes' ? true : false,
|
||||
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
'link_venues' => get_option( 'sportspress_link_venues', 'no' ) == 'yes' ? true : false,
|
||||
'show_logos' => get_option( 'sportspress_countdown_show_logos', 'no' ) == 'yes' ? true : false,
|
||||
'team' => null,
|
||||
'calendar' => null,
|
||||
'order' => null,
|
||||
'orderby' => null,
|
||||
'league' => null,
|
||||
'season' => null,
|
||||
'id' => null,
|
||||
'title' => null,
|
||||
'live' => get_option( 'sportspress_enable_live_countdowns', 'yes' ) == 'yes' ? true : false,
|
||||
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
'link_venues' => get_option( 'sportspress_link_venues', 'no' ) == 'yes' ? true : false,
|
||||
'show_logos' => get_option( 'sportspress_countdown_show_logos', 'no' ) == 'yes' ? true : false,
|
||||
'show_thumbnail' => get_option( 'sportspress_countdown_show_thumbnail', 'no' ) == 'yes' ? true : false,
|
||||
);
|
||||
|
||||
if ( isset( $show_excluded ) && $show_excluded ){
|
||||
if ( isset( $show_excluded ) && $show_excluded ) {
|
||||
$excluded_statuses = array();
|
||||
}else{
|
||||
$excluded_statuses = apply_filters( 'sp_countdown_excluded_statuses', array(
|
||||
'postponed',
|
||||
'cancelled',
|
||||
) );
|
||||
} else {
|
||||
$excluded_statuses = apply_filters(
|
||||
'sp_countdown_excluded_statuses',
|
||||
array(
|
||||
'postponed',
|
||||
'cancelled',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ( isset( $id ) ):
|
||||
if ( isset( $id ) ) :
|
||||
$post = get_post( $id );
|
||||
elseif ( $calendar ):
|
||||
elseif ( $calendar ) :
|
||||
$calendar = new SP_Calendar( $calendar );
|
||||
if ( $team )
|
||||
if ( $team ) {
|
||||
$calendar->team = $team;
|
||||
}
|
||||
$calendar->status = 'future';
|
||||
if ( $order ) {
|
||||
$calendar->order = $order;
|
||||
}else{
|
||||
} else {
|
||||
$calendar->order = 'ASC';
|
||||
}
|
||||
if ( $orderby ) {
|
||||
@@ -56,35 +62,35 @@ elseif ( $calendar ):
|
||||
* Exclude postponed or cancelled events.
|
||||
*/
|
||||
while ( $post = array_shift( $data ) ) {
|
||||
$sp_status = get_post_meta($post->ID, 'sp_status', true);
|
||||
if( ! in_array( $sp_status, $excluded_statuses ) ) {
|
||||
$sp_status = get_post_meta( $post->ID, 'sp_status', true );
|
||||
if ( ! in_array( $sp_status, $excluded_statuses ) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
else:
|
||||
else :
|
||||
$args = array();
|
||||
if ( isset( $team ) ) {
|
||||
$args['meta_query'] = array(
|
||||
array(
|
||||
'key' => 'sp_team',
|
||||
'key' => 'sp_team',
|
||||
'value' => $team,
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
if ( isset( $league ) || isset( $season ) ) {
|
||||
$args['tax_query'] = array( 'relation' => 'AND' );
|
||||
|
||||
|
||||
if ( isset( $league ) ) {
|
||||
$args['tax_query'][] = array(
|
||||
'taxonomy' => 'sp_league',
|
||||
'terms' => $league,
|
||||
'terms' => $league,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if ( isset( $season ) ) {
|
||||
$args['tax_query'][] = array(
|
||||
'taxonomy' => 'sp_season',
|
||||
'terms' => $season,
|
||||
'terms' => $season,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -92,43 +98,53 @@ else:
|
||||
/**
|
||||
* Exclude postponed or cancelled events.
|
||||
*/
|
||||
$args['meta_query'][] = [
|
||||
'key' => 'sp_status',
|
||||
$args['meta_query'][] = array(
|
||||
'key' => 'sp_status',
|
||||
'compare' => 'NOT IN',
|
||||
'value' => $excluded_statuses,
|
||||
];
|
||||
'value' => $excluded_statuses,
|
||||
);
|
||||
|
||||
$post = sp_get_next_event( $args );
|
||||
endif;
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
|
||||
if ( ! isset( $post ) || ! $post ) return;
|
||||
if ( ! isset( $post ) || ! $post ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $title )
|
||||
if ( $title ) {
|
||||
echo '<h4 class="sp-table-caption">' . $title . '</h4>';
|
||||
}
|
||||
|
||||
$title = $post->post_title;
|
||||
if ( $link_events ) $title = '<a href="' . get_post_permalink( $post->ID, false, true ) . '">' . $title . '</a>';
|
||||
if ( isset( $show_status ) && $show_status ){
|
||||
$sp_status = get_post_meta($post->ID, 'sp_status', true);
|
||||
//Avoid Undefined index warnings if no status is set (i.e. during import)
|
||||
if ( $sp_status == '' ) $sp_status = 'ok';
|
||||
$statuses = apply_filters( 'sportspress_event_statuses', array(
|
||||
'ok' => __( 'On time', 'sportspress' ),
|
||||
'tbd' => __( 'TBD', 'sportspress' ),
|
||||
'postponed' => __( 'Postponed', 'sportspress' ),
|
||||
'cancelled' => __( 'Canceled', 'sportspress' ),
|
||||
) );
|
||||
$title = $title.' ('.$statuses[ $sp_status ].')';
|
||||
if ( $link_events ) {
|
||||
$title = '<a href="' . get_post_permalink( $post->ID, false, true ) . '">' . $title . '</a>';
|
||||
}
|
||||
if ( isset( $show_status ) && $show_status ) {
|
||||
$sp_status = get_post_meta( $post->ID, 'sp_status', true );
|
||||
// Avoid Undefined index warnings if no status is set (i.e. during import)
|
||||
if ( $sp_status == '' ) {
|
||||
$sp_status = 'ok';
|
||||
}
|
||||
$statuses = apply_filters(
|
||||
'sportspress_event_statuses',
|
||||
array(
|
||||
'ok' => __( 'On time', 'sportspress' ),
|
||||
'tbd' => __( 'TBD', 'sportspress' ),
|
||||
'postponed' => __( 'Postponed', 'sportspress' ),
|
||||
'cancelled' => __( 'Canceled', 'sportspress' ),
|
||||
)
|
||||
);
|
||||
$title = $title . ' (' . $statuses[ $sp_status ] . ')';
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="sp-template sp-template-countdown">
|
||||
<div class="sp-countdown-wrapper">
|
||||
<?php
|
||||
<?php
|
||||
if ( $show_thumbnail && has_post_thumbnail( $post ) ) {
|
||||
?>
|
||||
?>
|
||||
<div class="event-image sp-event-image">
|
||||
<?php echo get_the_post_thumbnail( $post ); ?>
|
||||
</div>
|
||||
@@ -137,12 +153,12 @@ if ( isset( $show_status ) && $show_status ){
|
||||
<?php
|
||||
if ( $show_logos ) {
|
||||
$teams = array_unique( (array) get_post_meta( $post->ID, 'sp_team' ) );
|
||||
$i = 0;
|
||||
$i = 0;
|
||||
|
||||
if ( is_array( $teams ) ) {
|
||||
foreach ( $teams as $team ) {
|
||||
$i++;
|
||||
if ( has_post_thumbnail ( $team ) ) {
|
||||
if ( has_post_thumbnail( $team ) ) {
|
||||
if ( $link_teams ) {
|
||||
echo '<a class="team-logo logo-' . ( $i % 2 ? 'odd' : 'even' ) . '" href="' . get_post_permalink( $team ) . '" title="' . get_the_title( $team ) . '">' . get_the_post_thumbnail( $team, 'sportspress-fit-icon' ) . '</a>';
|
||||
} else {
|
||||
@@ -156,7 +172,7 @@ if ( isset( $show_status ) && $show_status ){
|
||||
<?php echo $title; ?>
|
||||
</h3>
|
||||
<?php
|
||||
if ( isset( $show_date ) && $show_date ):
|
||||
if ( isset( $show_date ) && $show_date ) :
|
||||
?>
|
||||
<h5 class="event-venue sp-event-venue event-date sp-event-date">
|
||||
<?php
|
||||
@@ -165,10 +181,10 @@ if ( isset( $show_status ) && $show_status ){
|
||||
</h5>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
if ( isset( $show_venue ) && $show_venue ):
|
||||
|
||||
if ( isset( $show_venue ) && $show_venue ) :
|
||||
$venues = get_the_terms( $post->ID, 'sp_venue' );
|
||||
if ( $venues ):
|
||||
if ( $venues ) :
|
||||
?>
|
||||
<h5 class="event-venue sp-event-venue">
|
||||
<?php
|
||||
@@ -187,10 +203,10 @@ if ( isset( $show_status ) && $show_status ){
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( isset( $show_league ) && $show_league ):
|
||||
if ( isset( $show_league ) && $show_league ) :
|
||||
$leagues = get_the_terms( $post->ID, 'sp_league' );
|
||||
if ( $leagues ):
|
||||
foreach( $leagues as $league ):
|
||||
if ( $leagues ) :
|
||||
foreach ( $leagues as $league ) :
|
||||
$term = get_term( $league->term_id, 'sp_league' );
|
||||
?>
|
||||
<h5 class="event-league sp-event-league"><?php echo $term->name; ?></h5>
|
||||
@@ -199,17 +215,25 @@ if ( isset( $show_status ) && $show_status ){
|
||||
endif;
|
||||
endif;
|
||||
|
||||
$now = new DateTime( current_time( 'mysql', 0 ) );
|
||||
$date = new DateTime( $post->post_date );
|
||||
$now = new DateTime( current_time( 'mysql', 0 ) );
|
||||
$date = new DateTime( $post->post_date );
|
||||
$interval = date_diff( $now, $date );
|
||||
|
||||
$days = $interval->invert ? 0 : $interval->days;
|
||||
$h = $interval->invert ? 0 : $interval->h;
|
||||
$i = $interval->invert ? 0 : $interval->i;
|
||||
$s = $interval->invert ? 0 : $interval->s;
|
||||
$h = $interval->invert ? 0 : $interval->h;
|
||||
$i = $interval->invert ? 0 : $interval->i;
|
||||
$s = $interval->invert ? 0 : $interval->s;
|
||||
?>
|
||||
<p class="countdown sp-countdown<?php if ( $days >= 10 ): ?> long-countdown<?php endif; ?>">
|
||||
<time datetime="<?php echo $post->post_date; ?>"<?php if ( $live ): ?> data-countdown="<?php echo str_replace( '-', '/', get_gmt_from_date( $post->post_date ) ); ?>"<?php endif; ?>>
|
||||
<p class="countdown sp-countdown
|
||||
<?php
|
||||
if ( $days >= 10 ) :
|
||||
?>
|
||||
long-countdown<?php endif; ?>">
|
||||
<time datetime="<?php echo $post->post_date; ?>"
|
||||
<?php
|
||||
if ( $live ) :
|
||||
?>
|
||||
data-countdown="<?php echo str_replace( '-', '/', get_gmt_from_date( $post->post_date ) ); ?>"<?php endif; ?>>
|
||||
<span><?php echo sprintf( '%02s', $days ); ?> <small><?php _e( 'days', 'sportspress' ); ?></small></span>
|
||||
<span><?php echo sprintf( '%02s', $h ); ?> <small><?php _e( 'hrs', 'sportspress' ); ?></small></span>
|
||||
<span><?php echo sprintf( '%02s', $i ); ?> <small><?php _e( 'mins', 'sportspress' ); ?></small></span>
|
||||
|
||||
@@ -2,168 +2,201 @@
|
||||
/**
|
||||
* Event Blocks
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.7.9
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
$defaults = array(
|
||||
'id' => null,
|
||||
'event' => null,
|
||||
'title' => false,
|
||||
'status' => 'default',
|
||||
'format' => 'default',
|
||||
'date' => 'default',
|
||||
'date_from' => 'default',
|
||||
'date_to' => 'default',
|
||||
'date_past' => 'default',
|
||||
'date_future' => 'default',
|
||||
'date_relative' => 'default',
|
||||
'day' => 'default',
|
||||
'league' => null,
|
||||
'season' => null,
|
||||
'venue' => null,
|
||||
'team' => null,
|
||||
'teams_past' => null,
|
||||
'date_before' => null,
|
||||
'player' => null,
|
||||
'number' => -1,
|
||||
'show_team_logo' => get_option( 'sportspress_event_blocks_show_logos', 'yes' ) == 'yes' ? true : false,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
||||
'paginated' => get_option( 'sportspress_event_blocks_paginated', 'yes' ) == 'yes' ? true : false,
|
||||
'rows' => get_option( 'sportspress_event_blocks_rows', 5 ),
|
||||
'orderby' => 'default',
|
||||
'order' => 'default',
|
||||
'columns' => null,
|
||||
'id' => null,
|
||||
'event' => null,
|
||||
'title' => false,
|
||||
'status' => 'default',
|
||||
'format' => 'default',
|
||||
'date' => 'default',
|
||||
'date_from' => 'default',
|
||||
'date_to' => 'default',
|
||||
'date_past' => 'default',
|
||||
'date_future' => 'default',
|
||||
'date_relative' => 'default',
|
||||
'day' => 'default',
|
||||
'league' => null,
|
||||
'season' => null,
|
||||
'venue' => null,
|
||||
'team' => null,
|
||||
'teams_past' => null,
|
||||
'date_before' => null,
|
||||
'player' => null,
|
||||
'number' => -1,
|
||||
'show_team_logo' => get_option( 'sportspress_event_blocks_show_logos', 'yes' ) == 'yes' ? true : false,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
||||
'paginated' => get_option( 'sportspress_event_blocks_paginated', 'yes' ) == 'yes' ? true : false,
|
||||
'rows' => get_option( 'sportspress_event_blocks_rows', 5 ),
|
||||
'orderby' => 'default',
|
||||
'order' => 'default',
|
||||
'columns' => null,
|
||||
'show_all_events_link' => false,
|
||||
'show_title' => get_option( 'sportspress_event_blocks_show_title', 'no' ) == 'yes' ? true : 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_matchday' => get_option( 'sportspress_event_blocks_show_matchday', 'no' ) == 'yes' ? true : false,
|
||||
'show_venue' => get_option( 'sportspress_event_blocks_show_venue', 'no' ) == 'yes' ? true : false,
|
||||
'hide_if_empty' => false,
|
||||
'show_title' => get_option( 'sportspress_event_blocks_show_title', 'no' ) == 'yes' ? true : 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_matchday' => get_option( 'sportspress_event_blocks_show_matchday', 'no' ) == 'yes' ? true : false,
|
||||
'show_venue' => get_option( 'sportspress_event_blocks_show_venue', 'no' ) == 'yes' ? true : false,
|
||||
'hide_if_empty' => false,
|
||||
);
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
|
||||
$calendar = new SP_Calendar( $id );
|
||||
|
||||
if ( $status != 'default' )
|
||||
if ( $status != 'default' ) {
|
||||
$calendar->status = $status;
|
||||
if ( $format != 'default' )
|
||||
}
|
||||
if ( $format != 'default' ) {
|
||||
$calendar->event_format = $format;
|
||||
if ( $date != 'default' )
|
||||
}
|
||||
if ( $date != 'default' ) {
|
||||
$calendar->date = $date;
|
||||
if ( $date_from != 'default' )
|
||||
}
|
||||
if ( $date_from != 'default' ) {
|
||||
$calendar->from = $date_from;
|
||||
if ( $date_to != 'default' )
|
||||
}
|
||||
if ( $date_to != 'default' ) {
|
||||
$calendar->to = $date_to;
|
||||
if ( $date_past != 'default' )
|
||||
}
|
||||
if ( $date_past != 'default' ) {
|
||||
$calendar->past = $date_past;
|
||||
if ( $date_future != 'default' )
|
||||
}
|
||||
if ( $date_future != 'default' ) {
|
||||
$calendar->future = $date_future;
|
||||
if ( $date_relative != 'default' )
|
||||
}
|
||||
if ( $date_relative != 'default' ) {
|
||||
$calendar->relative = $date_relative;
|
||||
if ( $event )
|
||||
}
|
||||
if ( $event ) {
|
||||
$calendar->event = $event;
|
||||
if ( $league )
|
||||
}
|
||||
if ( $league ) {
|
||||
$calendar->league = $league;
|
||||
if ( $season )
|
||||
}
|
||||
if ( $season ) {
|
||||
$calendar->season = $season;
|
||||
if ( $venue )
|
||||
}
|
||||
if ( $venue ) {
|
||||
$calendar->venue = $venue;
|
||||
if ( $team )
|
||||
}
|
||||
if ( $team ) {
|
||||
$calendar->team = $team;
|
||||
if ( $teams_past )
|
||||
}
|
||||
if ( $teams_past ) {
|
||||
$calendar->teams_past = $teams_past;
|
||||
if ( $date_before )
|
||||
}
|
||||
if ( $date_before ) {
|
||||
$calendar->date_before = $date_before;
|
||||
if ( $player )
|
||||
}
|
||||
if ( $player ) {
|
||||
$calendar->player = $player;
|
||||
if ( $order != 'default' )
|
||||
}
|
||||
if ( $order != 'default' ) {
|
||||
$calendar->order = $order;
|
||||
if ( $orderby != 'default' )
|
||||
}
|
||||
if ( $orderby != 'default' ) {
|
||||
$calendar->orderby = $orderby;
|
||||
if ( $day != 'default' )
|
||||
}
|
||||
if ( $day != 'default' ) {
|
||||
$calendar->day = $day;
|
||||
$data = $calendar->data();
|
||||
}
|
||||
$data = $calendar->data();
|
||||
$usecolumns = $calendar->columns;
|
||||
|
||||
if ( isset( $columns ) ):
|
||||
if ( is_array( $columns ) )
|
||||
if ( isset( $columns ) ) :
|
||||
if ( is_array( $columns ) ) {
|
||||
$usecolumns = $columns;
|
||||
else
|
||||
} else {
|
||||
$usecolumns = explode( ',', $columns );
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( $hide_if_empty && empty( $data ) ) return false;
|
||||
if ( $hide_if_empty && empty( $data ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( $show_title && false === $title && $id ):
|
||||
if ( $show_title && false === $title && $id ) :
|
||||
$caption = $calendar->caption;
|
||||
if ( $caption )
|
||||
if ( $caption ) {
|
||||
$title = $caption;
|
||||
else
|
||||
} else {
|
||||
$title = get_the_title( $id );
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( $title )
|
||||
if ( $title ) {
|
||||
echo '<h4 class="sp-table-caption">' . $title . '</h4>';
|
||||
}
|
||||
?>
|
||||
<div class="sp-template sp-template-event-blocks">
|
||||
<div class="sp-table-wrapper">
|
||||
<table class="sp-event-blocks sp-data-table<?php if ( $paginated ) { ?> sp-paginated-table<?php } ?>" data-sp-rows="<?php echo $rows; ?>">
|
||||
<thead><tr><th></th></tr></thead> <?php # Required for DataTables ?>
|
||||
<table class="sp-event-blocks sp-data-table
|
||||
<?php
|
||||
if ( $paginated ) {
|
||||
?>
|
||||
sp-paginated-table<?php } ?>" data-sp-rows="<?php echo $rows; ?>">
|
||||
<thead><tr><th></th></tr></thead> <?php // Required for DataTables ?>
|
||||
<tbody>
|
||||
<?php
|
||||
$i = 0;
|
||||
|
||||
if ( intval( $number ) > 0 )
|
||||
if ( intval( $number ) > 0 ) {
|
||||
$limit = $number;
|
||||
}
|
||||
|
||||
foreach ( $data as $event ):
|
||||
if ( isset( $limit ) && $i >= $limit ) continue;
|
||||
foreach ( $data as $event ) :
|
||||
if ( isset( $limit ) && $i >= $limit ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$permalink = get_post_permalink( $event, false, true );
|
||||
$results = sp_get_main_results_or_time( $event );
|
||||
$results = sp_get_main_results_or_time( $event );
|
||||
|
||||
$teams = array_unique( get_post_meta( $event->ID, 'sp_team' ) );
|
||||
$teams = array_filter( $teams, 'sp_filter_positive' );
|
||||
$logos = array();
|
||||
$teams = array_unique( get_post_meta( $event->ID, 'sp_team' ) );
|
||||
$teams = array_filter( $teams, 'sp_filter_positive' );
|
||||
$logos = array();
|
||||
$event_status = get_post_meta( $event->ID, 'sp_status', true );
|
||||
|
||||
if ( get_option( 'sportspress_event_reverse_teams', 'no' ) === 'yes' ) {
|
||||
$teams = array_reverse( $teams , true );
|
||||
$results = array_reverse( $results , true );
|
||||
$teams = array_reverse( $teams, true );
|
||||
$results = array_reverse( $results, true );
|
||||
}
|
||||
|
||||
if ( $show_team_logo ):
|
||||
if ( $show_team_logo ) :
|
||||
$j = 0;
|
||||
foreach( $teams as $team ):
|
||||
foreach ( $teams as $team ) :
|
||||
$j++;
|
||||
$team_name = get_the_title( $team );
|
||||
if ( has_post_thumbnail ( $team ) ):
|
||||
if ( has_post_thumbnail( $team ) ) :
|
||||
$logo = get_the_post_thumbnail( $team, 'sportspress-fit-icon', array( 'itemprop' => 'logo' ) );
|
||||
|
||||
if ( $link_teams ):
|
||||
if ( $link_teams ) :
|
||||
$team_permalink = get_permalink( $team, false, true );
|
||||
$logo = '<a href="' . $team_permalink . '" itemprop="url" content="' . $team_permalink . '">' . $logo . '</a>';
|
||||
$logo = '<a href="' . $team_permalink . '" itemprop="url" content="' . $team_permalink . '">' . $logo . '</a>';
|
||||
endif;
|
||||
|
||||
$logo = '<span class="team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) . '" title="' . $team_name . '" itemprop="competitor" itemscope itemtype="http://schema.org/SportsTeam"><meta itemprop="name" content="' . $team_name . '">' . $logo . '</span>';
|
||||
else:
|
||||
else :
|
||||
$logo = '<span itemprop="competitor" itemscope itemtype="http://schema.org/SportsTeam"><meta itemprop="name" content="' . $team_name . '"></span>';
|
||||
endif;
|
||||
|
||||
$logos[] = $logo;
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
if ( 'day' === $calendar->orderby ):
|
||||
|
||||
if ( 'day' === $calendar->orderby ) :
|
||||
$event_group = get_post_meta( $event->ID, 'sp_day', true );
|
||||
if ( ! isset( $group ) || $event_group !== $group ):
|
||||
if ( ! isset( $group ) || $event_group !== $group ) :
|
||||
$group = $event_group;
|
||||
echo '<tr><th><strong class="sp-event-group-name">', __( 'Match Day', 'sportspress' ), ' ', $group, '</strong></th></tr>';
|
||||
endif;
|
||||
@@ -176,22 +209,52 @@ if ( $title )
|
||||
<time class="sp-event-date" datetime="<?php echo $event->post_date; ?>" itemprop="startDate" content="<?php echo mysql2date( 'Y-m-d\TH:iP', $event->post_date ); ?>">
|
||||
<?php echo wp_kses_post( sp_add_link( get_the_time( get_option( 'date_format' ), $event ), $permalink, $link_events ) ); ?>
|
||||
</time>
|
||||
<?php if ( $show_matchday ): $matchday = get_post_meta( $event->ID, 'sp_day', true ); if ( $matchday != '' ): ?>
|
||||
<?php
|
||||
if ( $show_matchday ) :
|
||||
$matchday = get_post_meta( $event->ID, 'sp_day', true ); if ( $matchday != '' ) :
|
||||
?>
|
||||
<div class="sp-event-matchday">(<?php echo wp_kses_post( $matchday ); ?>)</div>
|
||||
<?php endif; endif; ?>
|
||||
<?php
|
||||
endif;
|
||||
endif;
|
||||
?>
|
||||
<h5 class="sp-event-results">
|
||||
<?php echo wp_kses_post( sp_add_link( '<span class="sp-result '.$event_status.'">' . implode( '</span> - <span class="sp-result">', apply_filters( 'sportspress_event_blocks_team_result_or_time', $results, $event->ID ) ) . '</span>', $permalink, $link_events ) ); ?>
|
||||
<?php echo wp_kses_post( sp_add_link( '<span class="sp-result ' . $event_status . '">' . implode( '</span> - <span class="sp-result">', apply_filters( 'sportspress_event_blocks_team_result_or_time', $results, $event->ID ) ) . '</span>', $permalink, $link_events ) ); ?>
|
||||
</h5>
|
||||
<?php if ( $show_league ): $leagues = get_the_terms( $event, 'sp_league' ); if ( $leagues ): $league = array_shift( $leagues ); ?>
|
||||
<?php
|
||||
if ( $show_league ) :
|
||||
$leagues = get_the_terms( $event, 'sp_league' );
|
||||
if ( $leagues ) :
|
||||
$league = array_shift( $leagues );
|
||||
?>
|
||||
<div class="sp-event-league"><?php echo $league->name; ?></div>
|
||||
<?php endif; endif; ?>
|
||||
<?php if ( $show_season ): $seasons = get_the_terms( $event, 'sp_season' ); if ( $seasons ): $season = array_shift( $seasons ); ?>
|
||||
<?php
|
||||
endif;
|
||||
endif;
|
||||
?>
|
||||
<?php
|
||||
if ( $show_season ) :
|
||||
$seasons = get_the_terms( $event, 'sp_season' );
|
||||
if ( $seasons ) :
|
||||
$season = array_shift( $seasons );
|
||||
?>
|
||||
<div class="sp-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 ); ?>
|
||||
<?php
|
||||
endif;
|
||||
endif;
|
||||
?>
|
||||
<?php
|
||||
if ( $show_venue ) :
|
||||
$venues = get_the_terms( $event, 'sp_venue' );
|
||||
if ( $venues ) :
|
||||
$venue = array_shift( $venues );
|
||||
?>
|
||||
<div class="sp-event-venue" itemprop="location" itemscope itemtype="http://schema.org/Place"><div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"><?php echo $venue->name; ?></div></div>
|
||||
<?php endif; endif; ?>
|
||||
<?php if ( !$show_venue || !$venues ): ?>
|
||||
<?php
|
||||
endif;
|
||||
endif;
|
||||
?>
|
||||
<?php if ( ! $show_venue || ! $venues ) : ?>
|
||||
<div style="display:none;" class="sp-event-venue" itemprop="location" itemscope itemtype="http://schema.org/Place"><div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"><?php _e( 'N/A', 'sportspress' ); ?></div></div>
|
||||
<?php endif; ?>
|
||||
<h4 class="sp-event-title" itemprop="name">
|
||||
@@ -209,7 +272,8 @@ if ( $title )
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
if ( $id && $show_all_events_link )
|
||||
if ( $id && $show_all_events_link ) {
|
||||
echo '<div class="sp-calendar-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a></div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
@@ -2,33 +2,35 @@
|
||||
/**
|
||||
* Event Calendar
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.7.9
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
global $wpdb, $m, $monthnum, $year, $wp_locale;
|
||||
|
||||
$defaults = array(
|
||||
'id' => null,
|
||||
'status' => 'default',
|
||||
'format' => 'default',
|
||||
'date' => 'default',
|
||||
'date_from' => 'default',
|
||||
'date_to' => 'default',
|
||||
'date_past' => 'default',
|
||||
'date_future' => 'default',
|
||||
'date_relative' => 'default',
|
||||
'day' => 'default',
|
||||
'league' => null,
|
||||
'season' => null,
|
||||
'venue' => null,
|
||||
'team' => null,
|
||||
'player' => null,
|
||||
'initial' => true,
|
||||
'caption_tag' => 'caption',
|
||||
'id' => null,
|
||||
'status' => 'default',
|
||||
'format' => 'default',
|
||||
'date' => 'default',
|
||||
'date_from' => 'default',
|
||||
'date_to' => 'default',
|
||||
'date_past' => 'default',
|
||||
'date_future' => 'default',
|
||||
'date_relative' => 'default',
|
||||
'day' => 'default',
|
||||
'league' => null,
|
||||
'season' => null,
|
||||
'venue' => null,
|
||||
'team' => null,
|
||||
'player' => null,
|
||||
'initial' => true,
|
||||
'caption_tag' => 'caption',
|
||||
'show_all_events_link' => false,
|
||||
'override_global_date' => false,
|
||||
);
|
||||
@@ -36,37 +38,51 @@ $defaults = array(
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
|
||||
$calendar = new SP_Calendar( $id );
|
||||
if ( $status != 'default' )
|
||||
if ( $status != 'default' ) {
|
||||
$calendar->status = $status;
|
||||
if ( $format != 'default' )
|
||||
}
|
||||
if ( $format != 'default' ) {
|
||||
$calendar->event_format = $format;
|
||||
if ( $date != 'default' )
|
||||
}
|
||||
if ( $date != 'default' ) {
|
||||
$calendar->date = $date;
|
||||
if ( $date_from != 'default' )
|
||||
}
|
||||
if ( $date_from != 'default' ) {
|
||||
$calendar->from = $date_from;
|
||||
if ( $date_to != 'default' )
|
||||
}
|
||||
if ( $date_to != 'default' ) {
|
||||
$calendar->to = $date_to;
|
||||
if ( $date_past != 'default' )
|
||||
}
|
||||
if ( $date_past != 'default' ) {
|
||||
$calendar->past = $date_past;
|
||||
if ( $date_future != 'default' )
|
||||
}
|
||||
if ( $date_future != 'default' ) {
|
||||
$calendar->future = $date_future;
|
||||
if ( $date_relative != 'default' )
|
||||
}
|
||||
if ( $date_relative != 'default' ) {
|
||||
$calendar->relative = $date_relative;
|
||||
if ( $day != 'default' )
|
||||
}
|
||||
if ( $day != 'default' ) {
|
||||
$calendar->day = $day;
|
||||
if ( $league )
|
||||
}
|
||||
if ( $league ) {
|
||||
$calendar->league = $league;
|
||||
if ( $season )
|
||||
}
|
||||
if ( $season ) {
|
||||
$calendar->season = $season;
|
||||
if ( $venue )
|
||||
}
|
||||
if ( $venue ) {
|
||||
$calendar->venue = $venue;
|
||||
if ( $team )
|
||||
}
|
||||
if ( $team ) {
|
||||
$calendar->team = $team;
|
||||
if ( $player )
|
||||
}
|
||||
if ( $player ) {
|
||||
$calendar->player = $player;
|
||||
if ($override_global_date) {
|
||||
$year = gmdate('Y', current_time('timestamp'));
|
||||
$monthnum = gmdate('m', current_time('timestamp'));
|
||||
}
|
||||
if ( $override_global_date ) {
|
||||
$year = gmdate( 'Y', current_time( 'timestamp' ) );
|
||||
$monthnum = gmdate( 'm', current_time( 'timestamp' ) );
|
||||
}
|
||||
$events = $calendar->data();
|
||||
|
||||
@@ -74,73 +90,78 @@ if ( empty( $events ) ) {
|
||||
$in = 'AND 1 = 0'; // False logic to prevent SQL error
|
||||
} else {
|
||||
$event_ids = wp_list_pluck( $events, 'ID' );
|
||||
$in = 'AND ID IN (' . implode( ', ', $event_ids ) . ')';
|
||||
$in = 'AND ID IN (' . implode( ', ', $event_ids ) . ')';
|
||||
}
|
||||
|
||||
// week_begins = 0 stands for Sunday
|
||||
$week_begins = intval(get_option('start_of_week'));
|
||||
$week_begins = intval( get_option( 'start_of_week' ) );
|
||||
|
||||
// Get year and month from query vars
|
||||
$year = isset( $_GET['sp_year'] ) ? $_GET['sp_year'] : $year;
|
||||
$monthnum = isset( $_GET['sp_month'] ) ? $_GET['sp_month'] : $monthnum;
|
||||
$year = isset( $_GET['sp_year'] ) ? $_GET['sp_year'] : $year;
|
||||
$monthnum = isset( $_GET['sp_month'] ) ? $_GET['sp_month'] : $monthnum;
|
||||
|
||||
// Let's figure out when we are
|
||||
if ( !empty($monthnum) && !empty($year) ) {
|
||||
$thismonth = ''.zeroise(intval($monthnum), 2);
|
||||
$thisyear = ''.intval($year);
|
||||
} elseif ( !empty($w) ) {
|
||||
if ( ! empty( $monthnum ) && ! empty( $year ) ) {
|
||||
$thismonth = '' . zeroise( intval( $monthnum ), 2 );
|
||||
$thisyear = '' . intval( $year );
|
||||
} elseif ( ! empty( $w ) ) {
|
||||
// We need to get the month from MySQL
|
||||
$thisyear = ''.intval(substr($m, 0, 4));
|
||||
$d = (($w - 1) * 7) + 6; //it seems MySQL's weeks disagree with PHP's
|
||||
$thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')");
|
||||
} elseif ( !empty($m) ) {
|
||||
$thisyear = ''.intval(substr($m, 0, 4));
|
||||
if ( strlen($m) < 6 )
|
||||
$thisyear = '' . intval( substr( $m, 0, 4 ) );
|
||||
$d = ( ( $w - 1 ) * 7 ) + 6; // it seems MySQL's weeks disagree with PHP's
|
||||
$thismonth = $wpdb->get_var( "SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')" );
|
||||
} elseif ( ! empty( $m ) ) {
|
||||
$thisyear = '' . intval( substr( $m, 0, 4 ) );
|
||||
if ( strlen( $m ) < 6 ) {
|
||||
$thismonth = '01';
|
||||
else
|
||||
$thismonth = ''.zeroise(intval(substr($m, 4, 2)), 2);
|
||||
} else {
|
||||
$thismonth = '' . zeroise( intval( substr( $m, 4, 2 ) ), 2 );
|
||||
}
|
||||
} else {
|
||||
$thisyear = gmdate('Y', current_time('timestamp'));
|
||||
$thismonth = gmdate('m', current_time('timestamp'));
|
||||
$thisyear = gmdate( 'Y', current_time( 'timestamp' ) );
|
||||
$thismonth = gmdate( 'm', current_time( 'timestamp' ) );
|
||||
}
|
||||
|
||||
$unixmonth = mktime(0, 0 , 0, $thismonth, 1, $thisyear);
|
||||
$last_day = date('t', $unixmonth);
|
||||
$unixmonth = mktime( 0, 0, 0, $thismonth, 1, $thisyear );
|
||||
$last_day = date( 't', $unixmonth );
|
||||
|
||||
// Get the next and previous month and year with at least one post
|
||||
$previous = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
|
||||
$previous = $wpdb->get_row(
|
||||
"SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
|
||||
FROM $wpdb->posts
|
||||
WHERE post_date < '$thisyear-$thismonth-01'
|
||||
AND post_type = 'sp_event' AND ( post_status = 'publish' OR post_status = 'future' )
|
||||
$in
|
||||
ORDER BY post_date DESC
|
||||
LIMIT 1");
|
||||
$next = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
|
||||
LIMIT 1"
|
||||
);
|
||||
$next = $wpdb->get_row(
|
||||
"SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
|
||||
FROM $wpdb->posts
|
||||
WHERE post_date > '$thisyear-$thismonth-{$last_day} 23:59:59'
|
||||
AND post_type = 'sp_event' AND ( post_status = 'publish' OR post_status = 'future' )
|
||||
$in
|
||||
ORDER BY post_date ASC
|
||||
LIMIT 1");
|
||||
LIMIT 1"
|
||||
);
|
||||
|
||||
/* translators: Calendar caption: 1: month name, 2: 4-digit year */
|
||||
$calendar_caption = _x('%1$s %2$s', 'calendar caption', 'sportspress');
|
||||
$calendar_output = '
|
||||
$calendar_caption = _x( '%1$s %2$s', 'calendar caption', 'sportspress' );
|
||||
$calendar_output = '
|
||||
<div class="sp-calendar-wrapper">
|
||||
<table id="wp-calendar" class="sp-calendar sp-event-calendar sp-data-table">
|
||||
<caption class="sp-table-caption">' . ( $caption_tag == 'caption' ? '' : '<' . $caption_tag . '>' ) . sprintf($calendar_caption, $wp_locale->get_month($thismonth), date('Y', $unixmonth)) . ( $caption_tag == 'caption' ? '' : '</' . $caption_tag . '>' ) . '</caption>
|
||||
<caption class="sp-table-caption">' . ( $caption_tag == 'caption' ? '' : '<' . $caption_tag . '>' ) . sprintf( $calendar_caption, $wp_locale->get_month( $thismonth ), date( 'Y', $unixmonth ) ) . ( $caption_tag == 'caption' ? '' : '</' . $caption_tag . '>' ) . '</caption>
|
||||
<thead>
|
||||
<tr>';
|
||||
|
||||
$myweek = array();
|
||||
|
||||
for ( $wdcount=0; $wdcount<=6; $wdcount++ ) {
|
||||
$myweek[] = $wp_locale->get_weekday(($wdcount+$week_begins)%7);
|
||||
for ( $wdcount = 0; $wdcount <= 6; $wdcount++ ) {
|
||||
$myweek[] = $wp_locale->get_weekday( ( $wdcount + $week_begins ) % 7 );
|
||||
}
|
||||
|
||||
foreach ( $myweek as $wd ) {
|
||||
$day_name = (true == $initial) ? $wp_locale->get_weekday_initial($wd) : $wp_locale->get_weekday_abbrev($wd);
|
||||
$wd = esc_attr($wd);
|
||||
$day_name = ( true == $initial ) ? $wp_locale->get_weekday_initial( $wd ) : $wp_locale->get_weekday_abbrev( $wd );
|
||||
$wd = esc_attr( $wd );
|
||||
$calendar_output .= "\n\t\t<th scope=\"col\" title=\"$wd\">$day_name</th>";
|
||||
}
|
||||
|
||||
@@ -152,17 +173,27 @@ $calendar_output .= '
|
||||
<tr>';
|
||||
|
||||
if ( $previous ) {
|
||||
$calendar_output .= "\n\t\t".'<td colspan="3" id="prev" class="sp-previous-month"><a data-tooltip data-options="disable_for_touch:true" class="has-tooltip tip-right" href="' . add_query_arg( array( 'sp_year' => $previous->year, 'sp_month' => $previous->month ) ) . '" title="' . esc_attr( sprintf(_x('%1$s %2$s', 'calendar caption', 'sportspress'), $wp_locale->get_month($previous->month), date('Y', mktime(0, 0 , 0, $previous->month, 1, $previous->year)))) . '">« ' . $wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)) . '</a></td>';
|
||||
$calendar_output .= "\n\t\t" . '<td colspan="3" id="prev" class="sp-previous-month"><a data-tooltip data-options="disable_for_touch:true" class="has-tooltip tip-right" href="' . add_query_arg(
|
||||
array(
|
||||
'sp_year' => $previous->year,
|
||||
'sp_month' => $previous->month,
|
||||
)
|
||||
) . '" title="' . esc_attr( sprintf( _x( '%1$s %2$s', 'calendar caption', 'sportspress' ), $wp_locale->get_month( $previous->month ), date( 'Y', mktime( 0, 0, 0, $previous->month, 1, $previous->year ) ) ) ) . '">« ' . $wp_locale->get_month_abbrev( $wp_locale->get_month( $previous->month ) ) . '</a></td>';
|
||||
} else {
|
||||
$calendar_output .= "\n\t\t".'<td colspan="3" id="prev" class="pad"> </td>';
|
||||
$calendar_output .= "\n\t\t" . '<td colspan="3" id="prev" class="pad"> </td>';
|
||||
}
|
||||
|
||||
$calendar_output .= "\n\t\t".'<td class="pad"> </td>';
|
||||
$calendar_output .= "\n\t\t" . '<td class="pad"> </td>';
|
||||
|
||||
if ( $next ) {
|
||||
$calendar_output .= "\n\t\t".'<td colspan="3" id="next" class="sp-next-month"><a data-tooltip data-options="disable_for_touch:true" class="has-tooltip tip-left" href="' . add_query_arg( array( 'sp_year' => $next->year, 'sp_month' => $next->month ) ) . '" title="' . esc_attr( sprintf(_x('%1$s %2$s', 'calendar caption', 'sportspress'), $wp_locale->get_month($next->month), date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year))) ) . '">' . $wp_locale->get_month_abbrev($wp_locale->get_month($next->month)) . ' »</a></td>';
|
||||
$calendar_output .= "\n\t\t" . '<td colspan="3" id="next" class="sp-next-month"><a data-tooltip data-options="disable_for_touch:true" class="has-tooltip tip-left" href="' . add_query_arg(
|
||||
array(
|
||||
'sp_year' => $next->year,
|
||||
'sp_month' => $next->month,
|
||||
)
|
||||
) . '" title="' . esc_attr( sprintf( _x( '%1$s %2$s', 'calendar caption', 'sportspress' ), $wp_locale->get_month( $next->month ), date( 'Y', mktime( 0, 0, 0, $next->month, 1, $next->year ) ) ) ) . '">' . $wp_locale->get_month_abbrev( $wp_locale->get_month( $next->month ) ) . ' »</a></td>';
|
||||
} else {
|
||||
$calendar_output .= "\n\t\t".'<td colspan="3" id="next" class="pad"> </td>';
|
||||
$calendar_output .= "\n\t\t" . '<td colspan="3" id="next" class="pad"> </td>';
|
||||
}
|
||||
|
||||
$calendar_output .= '
|
||||
@@ -173,11 +204,14 @@ $calendar_output .= '
|
||||
<tr>';
|
||||
|
||||
// Get days with posts
|
||||
$dayswithposts = $wpdb->get_results("SELECT DAYOFMONTH(post_date), ID
|
||||
$dayswithposts = $wpdb->get_results(
|
||||
"SELECT DAYOFMONTH(post_date), ID
|
||||
FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00'
|
||||
AND post_type = 'sp_event' AND ( post_status = 'publish' OR post_status = 'future' )
|
||||
$in
|
||||
AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N);
|
||||
AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'",
|
||||
ARRAY_N
|
||||
);
|
||||
if ( $dayswithposts ) {
|
||||
foreach ( (array) $dayswithposts as $daywith ) {
|
||||
$daywithpost[ $daywith[0] ][] = $daywith[1];
|
||||
@@ -186,19 +220,20 @@ if ( $dayswithposts ) {
|
||||
$daywithpost = array();
|
||||
}
|
||||
|
||||
if ( array_key_exists( 'HTTP_USER_AGENT', $_SERVER ) && preg_match( '/(MSIE|camino|safari)/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
|
||||
if ( array_key_exists( 'HTTP_USER_AGENT', $_SERVER ) && preg_match( '/(MSIE|camino|safari)/', $_SERVER['HTTP_USER_AGENT'] ) ) {
|
||||
$ak_title_separator = "\n";
|
||||
} else {
|
||||
$ak_title_separator = ', ';
|
||||
}
|
||||
|
||||
$ak_titles_for_day = array();
|
||||
$ak_post_titles = $wpdb->get_results("SELECT ID, post_title, post_date, DAYOFMONTH(post_date) as dom "
|
||||
."FROM $wpdb->posts "
|
||||
."WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' "
|
||||
."AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' "
|
||||
."AND post_type = 'sp_event' AND ( post_status = 'publish' OR post_status = 'future' ) "
|
||||
."$in"
|
||||
$ak_post_titles = $wpdb->get_results(
|
||||
'SELECT ID, post_title, post_date, DAYOFMONTH(post_date) as dom '
|
||||
. "FROM $wpdb->posts "
|
||||
. "WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00' "
|
||||
. "AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59' "
|
||||
. "AND post_type = 'sp_event' AND ( post_status = 'publish' OR post_status = 'future' ) "
|
||||
. "$in"
|
||||
);
|
||||
if ( $ak_post_titles ) {
|
||||
foreach ( (array) $ak_post_titles as $ak_post_title ) {
|
||||
@@ -206,55 +241,65 @@ if ( $ak_post_titles ) {
|
||||
/** This filter is documented in wp-includes/post-template.php */
|
||||
$post_title = esc_attr( apply_filters( 'the_title', $ak_post_title->post_title, $ak_post_title->ID ) . ' @ ' . apply_filters( 'sportspress_event_time', date_i18n( get_option( 'time_format' ), strtotime( $ak_post_title->post_date ) ), $ak_post_title->ID ) );
|
||||
|
||||
if ( empty($ak_titles_for_day['day_'.$ak_post_title->dom]) )
|
||||
$ak_titles_for_day['day_'.$ak_post_title->dom] = '';
|
||||
if ( empty($ak_titles_for_day["$ak_post_title->dom"]) ) // first one
|
||||
$ak_titles_for_day["$ak_post_title->dom"] = $post_title;
|
||||
else
|
||||
$ak_titles_for_day["$ak_post_title->dom"] .= $ak_title_separator . $post_title;
|
||||
if ( empty( $ak_titles_for_day[ 'day_' . $ak_post_title->dom ] ) ) {
|
||||
$ak_titles_for_day[ 'day_' . $ak_post_title->dom ] = '';
|
||||
}
|
||||
if ( empty( $ak_titles_for_day[ "$ak_post_title->dom" ] ) ) { // first one
|
||||
$ak_titles_for_day[ "$ak_post_title->dom" ] = $post_title;
|
||||
} else {
|
||||
$ak_titles_for_day[ "$ak_post_title->dom" ] .= $ak_title_separator . $post_title;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// See how much we should pad in the beginning
|
||||
$pad = calendar_week_mod(date('w', $unixmonth)-$week_begins);
|
||||
if ( 0 != $pad )
|
||||
$calendar_output .= "\n\t\t".'<td colspan="'. esc_attr($pad) .'" class="pad"> </td>';
|
||||
$pad = calendar_week_mod( date( 'w', $unixmonth ) - $week_begins );
|
||||
if ( 0 != $pad ) {
|
||||
$calendar_output .= "\n\t\t" . '<td colspan="' . esc_attr( $pad ) . '" class="pad"> </td>';
|
||||
}
|
||||
|
||||
$daysinmonth = intval(date('t', $unixmonth));
|
||||
$daysinmonth = intval( date( 't', $unixmonth ) );
|
||||
for ( $day = 1; $day <= $daysinmonth; ++$day ) {
|
||||
if ( isset($newrow) && $newrow )
|
||||
if ( isset( $newrow ) && $newrow ) {
|
||||
$calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t";
|
||||
}
|
||||
$newrow = false;
|
||||
|
||||
$day_has_posts = array_key_exists($day, $daywithpost);
|
||||
$day_has_posts = array_key_exists( $day, $daywithpost );
|
||||
$td_properties = '';
|
||||
|
||||
if ( $day == gmdate('j', current_time('timestamp')) && $thismonth == gmdate('m', current_time('timestamp')) && $thisyear == gmdate('Y', current_time('timestamp')) )
|
||||
if ( $day == gmdate( 'j', current_time( 'timestamp' ) ) && $thismonth == gmdate( 'm', current_time( 'timestamp' ) ) && $thisyear == gmdate( 'Y', current_time( 'timestamp' ) ) ) {
|
||||
$td_properties .= ' id="today" class="sp-highlight"';
|
||||
}
|
||||
|
||||
if ( $day_has_posts )
|
||||
if ( $day_has_posts ) {
|
||||
$td_properties .= ' itemscope itemtype="http://schema.org/SportsEvent"';
|
||||
}
|
||||
|
||||
$calendar_output .= '<td' . $td_properties . '>';
|
||||
|
||||
if ( $day_has_posts ) // any posts today?
|
||||
if ( $day_has_posts ) { // any posts today?
|
||||
$calendar_output .= '<a data-tooltip data-options="disable_for_touch:true" class="has-tip" href="' . ( sizeof( $daywithpost[ $day ] ) > 1 ? add_query_arg( array( 'post_type' => 'sp_event' ), get_day_link( $thisyear, $thismonth, $day ) ) . '" title="' . sprintf( __( '%s events', 'sportspress' ), ( sizeof( $daywithpost[ $day ] ) ) ) : get_post_permalink( $daywithpost[ $day ][0], false, true ) . '" title="' . esc_attr( $ak_titles_for_day[ $day ] ) ) . "\" itemprop=\"url\">$day</a>";
|
||||
else
|
||||
} else {
|
||||
$calendar_output .= $day;
|
||||
}
|
||||
$calendar_output .= '</td>';
|
||||
|
||||
if ( 6 == calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins) )
|
||||
if ( 6 == calendar_week_mod( date( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) {
|
||||
$newrow = true;
|
||||
}
|
||||
}
|
||||
|
||||
$pad = 7 - calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins);
|
||||
if ( $pad != 0 && $pad != 7 )
|
||||
$calendar_output .= "\n\t\t".'<td class="pad" colspan="'. esc_attr($pad) .'"> </td>';
|
||||
$pad = 7 - calendar_week_mod( date( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins );
|
||||
if ( $pad != 0 && $pad != 7 ) {
|
||||
$calendar_output .= "\n\t\t" . '<td class="pad" colspan="' . esc_attr( $pad ) . '"> </td>';
|
||||
}
|
||||
|
||||
$calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>\n\t</div>";
|
||||
|
||||
if ( $id && $show_all_events_link )
|
||||
if ( $id && $show_all_events_link ) {
|
||||
$calendar_output .= '<div class="sp-calendar-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a></div>';
|
||||
}
|
||||
?>
|
||||
<div class="sp-template sp-template-event-calendar">
|
||||
<?php echo $calendar_output; ?>
|
||||
|
||||
@@ -2,38 +2,49 @@
|
||||
/**
|
||||
* Event Details
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.4
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( get_option( 'sportspress_event_show_details', 'yes' ) === 'no' ) return;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
if ( get_option( 'sportspress_event_show_details', 'yes' ) === 'no' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
||||
|
||||
$data = array();
|
||||
|
||||
if ( 'yes' === get_option( 'sportspress_event_show_date', 'yes' ) ) {
|
||||
$date = get_the_time( get_option('date_format'), $id );
|
||||
$date = get_the_time( get_option( 'date_format' ), $id );
|
||||
$data[ __( 'Date', 'sportspress' ) ] = $date;
|
||||
}
|
||||
|
||||
if ( 'yes' === get_option( 'sportspress_event_show_time', 'yes' ) ) {
|
||||
$time = get_the_time( get_option('time_format'), $id );
|
||||
$time = get_the_time( get_option( 'time_format' ), $id );
|
||||
$data[ __( 'Time', 'sportspress' ) ] = apply_filters( 'sportspress_event_time', $time, $id );
|
||||
}
|
||||
|
||||
$taxonomies = apply_filters( 'sportspress_event_taxonomies', array( 'sp_league' => null, 'sp_season' => null ) );
|
||||
$taxonomies = apply_filters(
|
||||
'sportspress_event_taxonomies',
|
||||
array(
|
||||
'sp_league' => null,
|
||||
'sp_season' => null,
|
||||
)
|
||||
);
|
||||
|
||||
foreach ( $taxonomies as $taxonomy => $post_type ):
|
||||
foreach ( $taxonomies as $taxonomy => $post_type ) :
|
||||
$terms = get_the_terms( $id, $taxonomy );
|
||||
if ( $terms ):
|
||||
$obj = get_taxonomy( $taxonomy );
|
||||
$term = array_shift( $terms );
|
||||
if ( $terms ) :
|
||||
$obj = get_taxonomy( $taxonomy );
|
||||
$term = array_shift( $terms );
|
||||
$data[ $obj->labels->singular_name ] = $term->name;
|
||||
endif;
|
||||
endforeach;
|
||||
@@ -55,26 +66,38 @@ if ( 'yes' === get_option( 'sportspress_event_show_full_time', 'yes' ) ) {
|
||||
|
||||
$data = apply_filters( 'sportspress_event_details', $data, $id );
|
||||
|
||||
if ( ! sizeof( $data ) ) return;
|
||||
if ( ! sizeof( $data ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div class="sp-template sp-template-event-details">
|
||||
<h4 class="sp-table-caption"><?php _e( 'Details', 'sportspress' ); ?></h4>
|
||||
<div class="sp-table-wrapper">
|
||||
<table class="sp-event-details sp-data-table<?php if ( $scrollable ) { ?> sp-scrollable-table<?php } ?>">
|
||||
<table class="sp-event-details sp-data-table
|
||||
<?php
|
||||
if ( $scrollable ) {
|
||||
?>
|
||||
sp-scrollable-table<?php } ?>">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php $i = 0; foreach( $data as $label => $value ): ?>
|
||||
<?php $i = 0; foreach ( $data as $label => $value ) : ?>
|
||||
<th><?php echo $label; ?></th>
|
||||
<?php $i++; endforeach; ?>
|
||||
<?php
|
||||
$i++;
|
||||
endforeach;
|
||||
?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<?php $i = 0; foreach( $data as $value ): ?>
|
||||
<?php $i = 0; foreach ( $data as $value ) : ?>
|
||||
<td><?php echo $value; ?></td>
|
||||
<?php $i++; endforeach; ?>
|
||||
<?php
|
||||
$i++;
|
||||
endforeach;
|
||||
?>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,73 +2,82 @@
|
||||
/**
|
||||
* Event Blocks
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.2
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
$defaults = array(
|
||||
'id' => null,
|
||||
'date' => 'default',
|
||||
'date_from' => 'default',
|
||||
'date_to' => 'default',
|
||||
'league' => null,
|
||||
'season' => null,
|
||||
'team' => null,
|
||||
'player' => null,
|
||||
'number' => -1,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
'id' => null,
|
||||
'date' => 'default',
|
||||
'date_from' => 'default',
|
||||
'date_to' => 'default',
|
||||
'league' => null,
|
||||
'season' => null,
|
||||
'team' => null,
|
||||
'player' => null,
|
||||
'number' => -1,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
||||
'paginated' => get_option( 'sportspress_event_blocks_paginated', 'yes' ) == 'yes' ? true : false,
|
||||
'rows' => get_option( 'sportspress_event_blocks_rows', 5 ),
|
||||
'paginated' => get_option( 'sportspress_event_blocks_paginated', 'yes' ) == 'yes' ? true : false,
|
||||
'rows' => get_option( 'sportspress_event_blocks_rows', 5 ),
|
||||
'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,
|
||||
'show_venue' => get_option( 'sportspress_event_blocks_show_venue', 'no' ) == 'yes' ? true : false,
|
||||
);
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
|
||||
$calendar = new SP_Calendar( $id );
|
||||
if ( $date != 'default' )
|
||||
if ( $date != 'default' ) {
|
||||
$calendar->date = $date;
|
||||
if ( $date_from != 'default' )
|
||||
}
|
||||
if ( $date_from != 'default' ) {
|
||||
$calendar->from = $date_from;
|
||||
if ( $date_to != 'default' )
|
||||
}
|
||||
if ( $date_to != 'default' ) {
|
||||
$calendar->to = $date_to;
|
||||
if ( $league )
|
||||
}
|
||||
if ( $league ) {
|
||||
$calendar->league = $league;
|
||||
if ( $season )
|
||||
}
|
||||
if ( $season ) {
|
||||
$calendar->season = $season;
|
||||
if ( $team )
|
||||
}
|
||||
if ( $team ) {
|
||||
$calendar->team = $team;
|
||||
if ( $player )
|
||||
}
|
||||
if ( $player ) {
|
||||
$calendar->player = $player;
|
||||
}
|
||||
|
||||
$args = array(
|
||||
'id' => $id,
|
||||
'title' => __( 'Fixtures', 'sportspress' ),
|
||||
'status' => 'future',
|
||||
'date' => $date,
|
||||
'date_from' => $date_from,
|
||||
'date_to' => $date_to,
|
||||
'league' => $league,
|
||||
'season' => $season,
|
||||
'team' => $team,
|
||||
'player' => $player,
|
||||
'number' => $number,
|
||||
'link_teams' => $link_teams,
|
||||
'link_events' => $link_events,
|
||||
'paginated' => $paginated,
|
||||
'rows' => $rows,
|
||||
'order' => 'ASC',
|
||||
'id' => $id,
|
||||
'title' => __( 'Fixtures', 'sportspress' ),
|
||||
'status' => 'future',
|
||||
'date' => $date,
|
||||
'date_from' => $date_from,
|
||||
'date_to' => $date_to,
|
||||
'league' => $league,
|
||||
'season' => $season,
|
||||
'team' => $team,
|
||||
'player' => $player,
|
||||
'number' => $number,
|
||||
'link_teams' => $link_teams,
|
||||
'link_events' => $link_events,
|
||||
'paginated' => $paginated,
|
||||
'rows' => $rows,
|
||||
'order' => 'ASC',
|
||||
'show_all_events_link' => false,
|
||||
'show_title' => true,
|
||||
'show_league' => $show_league,
|
||||
'show_season' => $show_season,
|
||||
'show_venue' => $show_venue,
|
||||
'hide_if_empty' => true,
|
||||
'show_title' => true,
|
||||
'show_league' => $show_league,
|
||||
'show_season' => $show_season,
|
||||
'show_venue' => $show_venue,
|
||||
'hide_if_empty' => true,
|
||||
);
|
||||
|
||||
echo '<div class="sp-fixtures-results">';
|
||||
@@ -77,9 +86,9 @@ ob_start();
|
||||
sp_get_template( 'event-blocks.php', $args );
|
||||
$fixtures = ob_get_clean();
|
||||
|
||||
$args['title'] = __( 'Results', 'sportspress' );
|
||||
$args['title'] = __( 'Results', 'sportspress' );
|
||||
$args['status'] = 'publish';
|
||||
$args['order'] = 'DESC';
|
||||
$args['order'] = 'DESC';
|
||||
|
||||
ob_start();
|
||||
sp_get_template( 'event-blocks.php', $args );
|
||||
@@ -89,7 +98,7 @@ if ( false == $fixtures || false == $results ) {
|
||||
|
||||
echo $fixtures;
|
||||
echo $results;
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
echo '<div class="sp-widget-align-left">';
|
||||
@@ -101,4 +110,4 @@ if ( false == $fixtures || false == $results ) {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
@@ -2,106 +2,127 @@
|
||||
/**
|
||||
* Event List
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.7.9
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
$defaults = array(
|
||||
'id' => null,
|
||||
'title' => false,
|
||||
'status' => 'default',
|
||||
'format' => 'default',
|
||||
'date' => 'default',
|
||||
'date_from' => 'default',
|
||||
'date_to' => 'default',
|
||||
'date_past' => 'default',
|
||||
'date_future' => 'default',
|
||||
'date_relative' => 'default',
|
||||
'day' => 'default',
|
||||
'league' => null,
|
||||
'season' => null,
|
||||
'venue' => null,
|
||||
'team' => null,
|
||||
'teams_past' => null,
|
||||
'date_before' => null,
|
||||
'player' => null,
|
||||
'number' => -1,
|
||||
'show_team_logo' => get_option( 'sportspress_event_list_show_logos', 'no' ) == 'yes' ? true : false,
|
||||
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
'link_venues' => get_option( 'sportspress_link_venues', 'yes' ) == 'yes' ? true : false,
|
||||
'responsive' => get_option( 'sportspress_enable_responsive_tables', 'no' ) == 'yes' ? true : false,
|
||||
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
'paginated' => get_option( 'sportspress_event_list_paginated', 'yes' ) == 'yes' ? true : false,
|
||||
'rows' => get_option( 'sportspress_event_list_rows', 10 ),
|
||||
'order' => 'default',
|
||||
'columns' => null,
|
||||
'id' => null,
|
||||
'title' => false,
|
||||
'status' => 'default',
|
||||
'format' => 'default',
|
||||
'date' => 'default',
|
||||
'date_from' => 'default',
|
||||
'date_to' => 'default',
|
||||
'date_past' => 'default',
|
||||
'date_future' => 'default',
|
||||
'date_relative' => 'default',
|
||||
'day' => 'default',
|
||||
'league' => null,
|
||||
'season' => null,
|
||||
'venue' => null,
|
||||
'team' => null,
|
||||
'teams_past' => null,
|
||||
'date_before' => null,
|
||||
'player' => null,
|
||||
'number' => -1,
|
||||
'show_team_logo' => get_option( 'sportspress_event_list_show_logos', 'no' ) == 'yes' ? true : false,
|
||||
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
'link_venues' => get_option( 'sportspress_link_venues', 'yes' ) == 'yes' ? true : false,
|
||||
'responsive' => get_option( 'sportspress_enable_responsive_tables', 'no' ) == 'yes' ? true : false,
|
||||
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
'paginated' => get_option( 'sportspress_event_list_paginated', 'yes' ) == 'yes' ? true : false,
|
||||
'rows' => get_option( 'sportspress_event_list_rows', 10 ),
|
||||
'order' => 'default',
|
||||
'columns' => null,
|
||||
'show_all_events_link' => false,
|
||||
'show_title' => get_option( 'sportspress_event_list_show_title', 'yes' ) == 'yes' ? true : false,
|
||||
'title_format' => get_option( 'sportspress_event_list_title_format', 'title' ),
|
||||
'time_format' => get_option( 'sportspress_event_list_time_format', 'combined' ),
|
||||
'show_title' => get_option( 'sportspress_event_list_show_title', 'yes' ) == 'yes' ? true : false,
|
||||
'title_format' => get_option( 'sportspress_event_list_title_format', 'title' ),
|
||||
'time_format' => get_option( 'sportspress_event_list_time_format', 'combined' ),
|
||||
);
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
|
||||
$calendar = new SP_Calendar( $id );
|
||||
if ( $status != 'default' )
|
||||
if ( $status != 'default' ) {
|
||||
$calendar->status = $status;
|
||||
if ( $format != 'default' )
|
||||
}
|
||||
if ( $format != 'default' ) {
|
||||
$calendar->event_format = $format;
|
||||
if ( $date != 'default' )
|
||||
}
|
||||
if ( $date != 'default' ) {
|
||||
$calendar->date = $date;
|
||||
if ( $date_from != 'default' )
|
||||
}
|
||||
if ( $date_from != 'default' ) {
|
||||
$calendar->from = $date_from;
|
||||
if ( $date_to != 'default' )
|
||||
}
|
||||
if ( $date_to != 'default' ) {
|
||||
$calendar->to = $date_to;
|
||||
if ( $date_past != 'default' )
|
||||
}
|
||||
if ( $date_past != 'default' ) {
|
||||
$calendar->past = $date_past;
|
||||
if ( $date_future != 'default' )
|
||||
}
|
||||
if ( $date_future != 'default' ) {
|
||||
$calendar->future = $date_future;
|
||||
if ( $date_relative != 'default' )
|
||||
}
|
||||
if ( $date_relative != 'default' ) {
|
||||
$calendar->relative = $date_relative;
|
||||
if ( $league )
|
||||
}
|
||||
if ( $league ) {
|
||||
$calendar->league = $league;
|
||||
if ( $season )
|
||||
}
|
||||
if ( $season ) {
|
||||
$calendar->season = $season;
|
||||
if ( $venue )
|
||||
}
|
||||
if ( $venue ) {
|
||||
$calendar->venue = $venue;
|
||||
if ( $team )
|
||||
}
|
||||
if ( $team ) {
|
||||
$calendar->team = $team;
|
||||
if ( $teams_past )
|
||||
}
|
||||
if ( $teams_past ) {
|
||||
$calendar->teams_past = $teams_past;
|
||||
if ( $date_before )
|
||||
}
|
||||
if ( $date_before ) {
|
||||
$calendar->date_before = $date_before;
|
||||
if ( $player )
|
||||
}
|
||||
if ( $player ) {
|
||||
$calendar->player = $player;
|
||||
if ( $order != 'default' )
|
||||
}
|
||||
if ( $order != 'default' ) {
|
||||
$calendar->order = $order;
|
||||
if ( $day != 'default' )
|
||||
}
|
||||
if ( $day != 'default' ) {
|
||||
$calendar->day = $day;
|
||||
$data = $calendar->data();
|
||||
}
|
||||
$data = $calendar->data();
|
||||
$usecolumns = $calendar->columns;
|
||||
|
||||
if ( isset( $columns ) ):
|
||||
if ( is_array( $columns ) )
|
||||
if ( isset( $columns ) ) :
|
||||
if ( is_array( $columns ) ) {
|
||||
$usecolumns = $columns;
|
||||
else
|
||||
} else {
|
||||
$usecolumns = explode( ',', $columns );
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( $show_title && false === $title && $id ):
|
||||
if ( $show_title && false === $title && $id ) :
|
||||
$caption = $calendar->caption;
|
||||
if ( $caption )
|
||||
if ( $caption ) {
|
||||
$title = $caption;
|
||||
else
|
||||
} else {
|
||||
$title = get_the_title( $id );
|
||||
}
|
||||
endif;
|
||||
$labels = array();
|
||||
//Create a unique identifier based on the current time in microseconds
|
||||
// Create a unique identifier based on the current time in microseconds
|
||||
$identifier = uniqid( 'eventlist_' );
|
||||
?>
|
||||
<div class="sp-template sp-template-event-list">
|
||||
@@ -109,7 +130,20 @@ $identifier = uniqid( 'eventlist_' );
|
||||
<h4 class="sp-table-caption"><?php echo $title; ?></h4>
|
||||
<?php } ?>
|
||||
<div class="sp-table-wrapper">
|
||||
<table class="sp-event-list sp-event-list-format-<?php echo $title_format; ?> sp-data-table<?php if ( $paginated ) { ?> sp-paginated-table<?php } if ( $sortable ) { ?> sp-sortable-table<?php } if ( $responsive ) { echo ' sp-responsive-table '.$identifier; } if ( $scrollable ) { ?> sp-scrollable-table <?php } ?>" data-sp-rows="<?php echo $rows; ?>">
|
||||
<table class="sp-event-list sp-event-list-format-<?php echo $title_format; ?> sp-data-table
|
||||
<?php
|
||||
if ( $paginated ) {
|
||||
?>
|
||||
sp-paginated-table
|
||||
<?php
|
||||
} if ( $sortable ) {
|
||||
?>
|
||||
sp-sortable-table
|
||||
<?php
|
||||
} if ( $responsive ) {
|
||||
echo ' sp-responsive-table ' . $identifier; } if ( $scrollable ) {
|
||||
?>
|
||||
sp-scrollable-table <?php } ?>" data-sp-rows="<?php echo $rows; ?>">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php
|
||||
@@ -138,7 +172,7 @@ $identifier = uniqid( 'eventlist_' );
|
||||
break;
|
||||
default:
|
||||
if ( sp_column_active( $usecolumns, 'event' ) ) {
|
||||
if ( $title_format == 'teams' ){
|
||||
if ( $title_format == 'teams' ) {
|
||||
echo '<th class="data-teams">' . __( 'Teams', 'sportspress' ) . '</th>';
|
||||
} else {
|
||||
echo '<th class="data-event">' . __( 'Event', 'sportspress' ) . '</th>';
|
||||
@@ -147,42 +181,51 @@ $identifier = uniqid( 'eventlist_' );
|
||||
|
||||
switch ( $time_format ) {
|
||||
case 'separate':
|
||||
if ( sp_column_active( $usecolumns, 'time' ) )
|
||||
if ( sp_column_active( $usecolumns, 'time' ) ) {
|
||||
echo '<th class="data-time">' . __( 'Time', 'sportspress' ) . '</th>';
|
||||
if ( sp_column_active( $usecolumns, 'results' ) )
|
||||
}
|
||||
if ( sp_column_active( $usecolumns, 'results' ) ) {
|
||||
echo '<th class="data-results">' . __( 'Results', 'sportspress' ) . '</th>';
|
||||
}
|
||||
break;
|
||||
case 'time':
|
||||
if ( sp_column_active( $usecolumns, 'time' ) )
|
||||
if ( sp_column_active( $usecolumns, 'time' ) ) {
|
||||
echo '<th class="data-time">' . __( 'Time', 'sportspress' ) . '</th>';
|
||||
}
|
||||
break;
|
||||
case 'results':
|
||||
if ( sp_column_active( $usecolumns, 'results' ) )
|
||||
if ( sp_column_active( $usecolumns, 'results' ) ) {
|
||||
echo '<th class="data-results">' . __( 'Results', 'sportspress' ) . '</th>';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ( sp_column_active( $usecolumns, 'time' ) )
|
||||
if ( sp_column_active( $usecolumns, 'time' ) ) {
|
||||
echo '<th class="data-time">' . __( 'Time/Results', 'sportspress' ) . '</th>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( sp_column_active( $usecolumns, 'league' ) )
|
||||
if ( sp_column_active( $usecolumns, 'league' ) ) {
|
||||
echo '<th class="data-league">' . __( 'League', 'sportspress' ) . '</th>';
|
||||
}
|
||||
|
||||
if ( sp_column_active( $usecolumns, 'season' ) )
|
||||
if ( sp_column_active( $usecolumns, 'season' ) ) {
|
||||
echo '<th class="data-season">' . __( 'Season', 'sportspress' ) . '</th>';
|
||||
}
|
||||
|
||||
if ( sp_column_active( $usecolumns, 'venue' ) ) {
|
||||
echo '<th class="data-venue">' . __( 'Venue', 'sportspress' ) . '</th>';
|
||||
}else{
|
||||
} else {
|
||||
echo '<th style="display:none;" class="data-venue">' . __( 'Venue', 'sportspress' ) . '</th>';
|
||||
}
|
||||
|
||||
if ( sp_column_active( $usecolumns, 'article' ) )
|
||||
if ( sp_column_active( $usecolumns, 'article' ) ) {
|
||||
echo '<th class="data-article">' . __( 'Article', 'sportspress' ) . '</th>';
|
||||
}
|
||||
|
||||
if ( sp_column_active( $usecolumns, 'day' ) )
|
||||
if ( sp_column_active( $usecolumns, 'day' ) ) {
|
||||
echo '<th class="data-day">' . __( 'Match Day', 'sportspress' ) . '</th>';
|
||||
}
|
||||
|
||||
do_action( 'sportspress_event_list_head_row', $usecolumns );
|
||||
?>
|
||||
@@ -192,14 +235,17 @@ $identifier = uniqid( 'eventlist_' );
|
||||
<?php
|
||||
$i = 0;
|
||||
|
||||
if ( is_numeric( $number ) && $number > 0 )
|
||||
if ( is_numeric( $number ) && $number > 0 ) {
|
||||
$limit = $number;
|
||||
}
|
||||
|
||||
foreach ( $data as $event ):
|
||||
if ( isset( $limit ) && $i >= $limit ) continue;
|
||||
foreach ( $data as $event ) :
|
||||
if ( isset( $limit ) && $i >= $limit ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$teams = get_post_meta( $event->ID, 'sp_team' );
|
||||
$video = get_post_meta( $event->ID, 'sp_video', true );
|
||||
$teams = get_post_meta( $event->ID, 'sp_team' );
|
||||
$video = get_post_meta( $event->ID, 'sp_video', true );
|
||||
$status = get_post_meta( $event->ID, 'sp_status', true );
|
||||
|
||||
$main_results = apply_filters( 'sportspress_event_list_main_results', sp_get_main_results( $event ), $event->ID );
|
||||
@@ -210,41 +256,41 @@ $identifier = uniqid( 'eventlist_' );
|
||||
}
|
||||
|
||||
$teams_output = '';
|
||||
$team_class = '';
|
||||
$teams_array = array();
|
||||
$team_logos = array();
|
||||
$team_class = '';
|
||||
$teams_array = array();
|
||||
$team_logos = array();
|
||||
|
||||
if ( $teams ):
|
||||
foreach ( $teams as $t => $team ):
|
||||
if ( $teams ) :
|
||||
foreach ( $teams as $t => $team ) :
|
||||
$name = sp_team_short_name( $team );
|
||||
if ( $name ):
|
||||
if ( $name ) :
|
||||
|
||||
$name = '<meta itemprop="name" content="' . $name . '">' . $name;
|
||||
|
||||
if ( $show_team_logo ):
|
||||
if ( has_post_thumbnail( $team ) ):
|
||||
$logo = '<span class="team-logo">' . sp_get_logo( $team, 'mini', array( 'itemprop' => 'url' ) ) . '</span>';
|
||||
if ( $show_team_logo ) :
|
||||
if ( has_post_thumbnail( $team ) ) :
|
||||
$logo = '<span class="team-logo">' . sp_get_logo( $team, 'mini', array( 'itemprop' => 'url' ) ) . '</span>';
|
||||
$team_logos[] = $logo;
|
||||
$team_class .= ' has-logo';
|
||||
|
||||
if ( $t ):
|
||||
$team_class .= ' has-logo';
|
||||
|
||||
if ( $t ) :
|
||||
$name = $logo . ' ' . $name;
|
||||
else:
|
||||
else :
|
||||
$name .= ' ' . $logo;
|
||||
endif;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $link_teams ):
|
||||
if ( $link_teams ) :
|
||||
$team_output = '<a href="' . get_post_permalink( $team ) . '" itemprop="url">' . $name . '</a>';
|
||||
else:
|
||||
else :
|
||||
$team_output = $name;
|
||||
endif;
|
||||
|
||||
$team_result = sp_array_value( $main_results, $team, null );
|
||||
|
||||
if ( $team_result != null ):
|
||||
if ( $usecolumns != null && ! in_array( 'time', $usecolumns ) ):
|
||||
if ( $team_result != null ) :
|
||||
if ( $usecolumns != null && ! in_array( 'time', $usecolumns ) ) :
|
||||
$team_output .= ' (' . $team_result . ')';
|
||||
endif;
|
||||
endif;
|
||||
@@ -254,7 +300,7 @@ $identifier = uniqid( 'eventlist_' );
|
||||
$teams_output .= $team_output . '<br>';
|
||||
endif;
|
||||
endforeach;
|
||||
else:
|
||||
else :
|
||||
$teams_output .= '—';
|
||||
endif;
|
||||
|
||||
@@ -262,188 +308,228 @@ $identifier = uniqid( 'eventlist_' );
|
||||
|
||||
$date_html = '<date>' . get_post_time( 'Y-m-d H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_date', get_post_time( get_option( 'date_format' ), false, $event, true ), $event->ID );
|
||||
|
||||
if ( $link_events ) $date_html = '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">' . $date_html . '</a>';
|
||||
if ( $link_events ) {
|
||||
$date_html = '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">' . $date_html . '</a>';
|
||||
}
|
||||
|
||||
echo '<td class="data-date" itemprop="startDate" content="' . mysql2date( 'Y-m-d\TH:iP', $event->post_date ) . '" data-label="'.__( 'Date', 'sportspress' ).'">' . $date_html . '</td>';
|
||||
|
||||
//Check if the reverse_teams option is selected and alter the teams order
|
||||
if ( $reverse_teams ) {
|
||||
$teams_array = array_reverse( $teams_array, true );
|
||||
}
|
||||
|
||||
switch ( $title_format ) {
|
||||
case 'homeaway':
|
||||
if ( sp_column_active( $usecolumns, 'event' ) ) {
|
||||
$team = array_shift( $teams_array );
|
||||
echo '<td class="data-home' . $team_class . '" itemprop="competitor" itemscope itemtype="http://schema.org/SportsTeam" data-label="'.__( 'Home', 'sportspress' ).'">' . $team . '</td>';
|
||||
echo '<td class="data-date" itemprop="startDate" content="' . mysql2date( 'Y-m-d\TH:iP', $event->post_date ) . '" data-label="' . __( 'Date', 'sportspress' ) . '">' . $date_html . '</td>';
|
||||
|
||||
// Check if the reverse_teams option is selected and alter the teams order
|
||||
if ( $reverse_teams ) {
|
||||
$teams_array = array_reverse( $teams_array, true );
|
||||
}
|
||||
|
||||
switch ( $title_format ) {
|
||||
case 'homeaway':
|
||||
if ( sp_column_active( $usecolumns, 'event' ) ) {
|
||||
$team = array_shift( $teams_array );
|
||||
echo '<td class="data-home' . $team_class . '" itemprop="competitor" itemscope itemtype="http://schema.org/SportsTeam" data-label="' . __( 'Home', 'sportspress' ) . '">' . $team . '</td>';
|
||||
}
|
||||
|
||||
if ( 'combined' == $time_format && sp_column_active( $usecolumns, 'time' ) ) {
|
||||
echo '<td class="data-time ' . $status . '" data-label="' . __( 'Time/Results', 'sportspress' ) . '">';
|
||||
if ( $link_events ) {
|
||||
echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
}
|
||||
|
||||
if ( 'combined' == $time_format && sp_column_active( $usecolumns, 'time' ) ) {
|
||||
echo '<td class="data-time '.$status.'" data-label="'.__( 'Time/Results', 'sportspress' ).'">';
|
||||
if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
if ( ! empty( $main_results ) ):
|
||||
echo implode( ' - ', $main_results );
|
||||
else:
|
||||
if ( ! empty( $main_results ) ) :
|
||||
echo implode( ' - ', $main_results );
|
||||
else :
|
||||
echo '<date> ' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
|
||||
endif;
|
||||
if ( $link_events ) echo '</a>';
|
||||
if ( $link_events ) {
|
||||
echo '</a>';
|
||||
}
|
||||
echo '</td>';
|
||||
} elseif ( in_array( $time_format, array( 'separate', 'results' ) ) && sp_column_active( $usecolumns, 'results' ) ) {
|
||||
echo '<td class="data-results" data-label="'.__( 'Results', 'sportspress' ).'">';
|
||||
if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
if ( ! empty( $main_results ) ):
|
||||
echo implode( ' - ', $main_results );
|
||||
else:
|
||||
} elseif ( in_array( $time_format, array( 'separate', 'results' ) ) && sp_column_active( $usecolumns, 'results' ) ) {
|
||||
echo '<td class="data-results" data-label="' . __( 'Results', 'sportspress' ) . '">';
|
||||
if ( $link_events ) {
|
||||
echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
}
|
||||
if ( ! empty( $main_results ) ) :
|
||||
echo implode( ' - ', $main_results );
|
||||
else :
|
||||
echo '-';
|
||||
endif;
|
||||
if ( $link_events ) echo '</a>';
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
if ( sp_column_active( $usecolumns, 'event' ) ) {
|
||||
$team = array_shift( $teams_array );
|
||||
echo '<td class="data-away' . $team_class . '" itemprop="competitor" itemscope itemtype="http://schema.org/SportsTeam" data-label="'.__( 'Away', 'sportspress' ).'">' . $team . '</td>';
|
||||
}
|
||||
|
||||
if ( in_array( $time_format, array( 'separate', 'time' ) ) && sp_column_active( $usecolumns, 'time' ) ) {
|
||||
echo '<td class="data-time '.$status.'" data-label="'.__( 'Time', 'sportspress' ).'">';
|
||||
if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
echo '<date> ' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
|
||||
if ( $link_events ) echo '</a>';
|
||||
echo '</td>';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ( sp_column_active( $usecolumns, 'event' ) ) {
|
||||
if ( $title_format == 'teams' ) {
|
||||
echo '<td class="data-event data-teams" data-label="'.__( 'Teams', 'sportspress' ).'">' . $teams_output . '</td>';
|
||||
} else {
|
||||
$title_html = implode( ' ', $team_logos ) . ' ' . $event->post_title;
|
||||
if ( $link_events ) $title_html = '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url name">' . $title_html . '</a>';
|
||||
echo '<td class="data-event" data-label="'.__( 'Event', 'sportspress' ).'">' . $title_html . '</td>';
|
||||
if ( $link_events ) {
|
||||
echo '</a>';
|
||||
}
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
switch ( $time_format ) {
|
||||
case 'separate':
|
||||
if ( sp_column_active( $usecolumns, 'time' ) ) {
|
||||
echo '<td class="data-time '.$status.'" data-label="'.__( 'Time', 'sportspress' ).'">';
|
||||
if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
echo '<date> ' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
|
||||
if ( $link_events ) echo '</a>';
|
||||
echo '</td>';
|
||||
if ( sp_column_active( $usecolumns, 'event' ) ) {
|
||||
$team = array_shift( $teams_array );
|
||||
echo '<td class="data-away' . $team_class . '" itemprop="competitor" itemscope itemtype="http://schema.org/SportsTeam" data-label="' . __( 'Away', 'sportspress' ) . '">' . $team . '</td>';
|
||||
}
|
||||
|
||||
if ( in_array( $time_format, array( 'separate', 'time' ) ) && sp_column_active( $usecolumns, 'time' ) ) {
|
||||
echo '<td class="data-time ' . $status . '" data-label="' . __( 'Time', 'sportspress' ) . '">';
|
||||
if ( $link_events ) {
|
||||
echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
}
|
||||
echo '<date> ' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
|
||||
if ( $link_events ) {
|
||||
echo '</a>';
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ( sp_column_active( $usecolumns, 'event' ) ) {
|
||||
if ( $title_format == 'teams' ) {
|
||||
echo '<td class="data-event data-teams" data-label="' . __( 'Teams', 'sportspress' ) . '">' . $teams_output . '</td>';
|
||||
} else {
|
||||
$title_html = implode( ' ', $team_logos ) . ' ' . $event->post_title;
|
||||
if ( $link_events ) {
|
||||
$title_html = '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url name">' . $title_html . '</a>';
|
||||
}
|
||||
echo '<td class="data-event" data-label="' . __( 'Event', 'sportspress' ) . '">' . $title_html . '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
switch ( $time_format ) {
|
||||
case 'separate':
|
||||
if ( sp_column_active( $usecolumns, 'time' ) ) {
|
||||
echo '<td class="data-time ' . $status . '" data-label="' . __( 'Time', 'sportspress' ) . '">';
|
||||
if ( $link_events ) {
|
||||
echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
}
|
||||
if ( sp_column_active( $usecolumns, 'results' ) ) {
|
||||
echo '<td class="data-results" data-label="'.__( 'Results', 'sportspress' ).'">';
|
||||
if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
if ( ! empty( $main_results ) ):
|
||||
echo implode( ' - ', $main_results );
|
||||
else:
|
||||
echo '<date> ' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
|
||||
if ( $link_events ) {
|
||||
echo '</a>';
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
if ( sp_column_active( $usecolumns, 'results' ) ) {
|
||||
echo '<td class="data-results" data-label="' . __( 'Results', 'sportspress' ) . '">';
|
||||
if ( $link_events ) {
|
||||
echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
}
|
||||
if ( ! empty( $main_results ) ) :
|
||||
echo implode( ' - ', $main_results );
|
||||
else :
|
||||
echo '-';
|
||||
endif;
|
||||
if ( $link_events ) echo '</a>';
|
||||
if ( $link_events ) {
|
||||
echo '</a>';
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
break;
|
||||
case 'time':
|
||||
if ( sp_column_active( $usecolumns, 'time' ) ) {
|
||||
echo '<td class="data-time ' . $status . '" data-label="' . __( 'Time', 'sportspress' ) . '">';
|
||||
if ( $link_events ) {
|
||||
echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
}
|
||||
break;
|
||||
case 'time':
|
||||
if ( sp_column_active( $usecolumns, 'time' ) ) {
|
||||
echo '<td class="data-time '.$status.'" data-label="'.__( 'Time', 'sportspress' ).'">';
|
||||
if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
echo '<date> ' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
|
||||
if ( $link_events ) echo '</a>';
|
||||
echo '</td>';
|
||||
echo '<date> ' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
|
||||
if ( $link_events ) {
|
||||
echo '</a>';
|
||||
}
|
||||
break;
|
||||
case 'results':
|
||||
if ( sp_column_active( $usecolumns, 'results' ) ) {
|
||||
echo '<td class="data-results" data-label="'.__( 'Results', 'sportspress' ).'">';
|
||||
if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
if ( ! empty( $main_results ) ):
|
||||
echo implode( ' - ', $main_results );
|
||||
else:
|
||||
echo '</td>';
|
||||
}
|
||||
break;
|
||||
case 'results':
|
||||
if ( sp_column_active( $usecolumns, 'results' ) ) {
|
||||
echo '<td class="data-results" data-label="' . __( 'Results', 'sportspress' ) . '">';
|
||||
if ( $link_events ) {
|
||||
echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
}
|
||||
if ( ! empty( $main_results ) ) :
|
||||
echo implode( ' - ', $main_results );
|
||||
else :
|
||||
echo '-';
|
||||
endif;
|
||||
if ( $link_events ) echo '</a>';
|
||||
if ( $link_events ) {
|
||||
echo '</a>';
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ( sp_column_active( $usecolumns, 'time' ) ) {
|
||||
echo '<td class="data-time ' . $status . '" data-label="' . __( 'Time/Results', 'sportspress' ) . '">';
|
||||
if ( $link_events ) {
|
||||
echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ( sp_column_active( $usecolumns, 'time' ) ) {
|
||||
echo '<td class="data-time '.$status.'" data-label="'.__( 'Time/Results', 'sportspress' ).'">';
|
||||
if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
if ( ! empty( $main_results ) ):
|
||||
echo implode( ' - ', $main_results );
|
||||
else:
|
||||
if ( ! empty( $main_results ) ) :
|
||||
echo implode( ' - ', $main_results );
|
||||
else :
|
||||
echo '<date> ' . get_post_time( 'H:i:s', false, $event ) . '</date>' . apply_filters( 'sportspress_event_time', sp_get_time( $event ), $event->ID );
|
||||
endif;
|
||||
if ( $link_events ) echo '</a>';
|
||||
if ( $link_events ) {
|
||||
echo '</a>';
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( sp_column_active( $usecolumns, 'league' ) ):
|
||||
echo '<td class="data-league" data-label="'.__( 'League', 'sportspress' ).'">';
|
||||
$leagues = get_the_terms( $event->ID, 'sp_league' );
|
||||
if ( $leagues ):
|
||||
echo implode( ', ', wp_list_pluck( $leagues, 'name' ) );
|
||||
if ( sp_column_active( $usecolumns, 'league' ) ) :
|
||||
echo '<td class="data-league" data-label="' . __( 'League', 'sportspress' ) . '">';
|
||||
$leagues = get_the_terms( $event->ID, 'sp_league' );
|
||||
if ( $leagues ) :
|
||||
echo implode( ', ', wp_list_pluck( $leagues, 'name' ) );
|
||||
endif;
|
||||
echo '</td>';
|
||||
echo '</td>';
|
||||
endif;
|
||||
|
||||
if ( sp_column_active( $usecolumns, 'season' ) ):
|
||||
echo '<td class="data-season" data-label="'.__( 'Season', 'sportspress' ).'">';
|
||||
$seasons = get_the_terms( $event->ID, 'sp_season' );
|
||||
if ( $seasons ):
|
||||
echo implode( ', ', wp_list_pluck( $seasons, 'name' ) );
|
||||
if ( sp_column_active( $usecolumns, 'season' ) ) :
|
||||
echo '<td class="data-season" data-label="' . __( 'Season', 'sportspress' ) . '">';
|
||||
$seasons = get_the_terms( $event->ID, 'sp_season' );
|
||||
if ( $seasons ) :
|
||||
echo implode( ', ', wp_list_pluck( $seasons, 'name' ) );
|
||||
endif;
|
||||
echo '</td>';
|
||||
echo '</td>';
|
||||
endif;
|
||||
|
||||
if ( sp_column_active( $usecolumns, 'venue' ) ):
|
||||
echo '<td class="data-venue" data-label="'.__( 'Venue', 'sportspress' ).'" itemprop="location" itemscope itemtype="http://schema.org/Place">';
|
||||
echo '<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">';
|
||||
if ( $link_venues ):
|
||||
the_terms( $event->ID, 'sp_venue' );
|
||||
else:
|
||||
if ( sp_column_active( $usecolumns, 'venue' ) ) :
|
||||
echo '<td class="data-venue" data-label="' . __( 'Venue', 'sportspress' ) . '" itemprop="location" itemscope itemtype="http://schema.org/Place">';
|
||||
echo '<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">';
|
||||
if ( $link_venues ) :
|
||||
the_terms( $event->ID, 'sp_venue' );
|
||||
else :
|
||||
$venues = get_the_terms( $event->ID, 'sp_venue' );
|
||||
if ( $venues ):
|
||||
if ( $venues ) :
|
||||
echo implode( ', ', wp_list_pluck( $venues, 'name' ) );
|
||||
endif;
|
||||
endif;
|
||||
echo '</div>';
|
||||
echo '</td>';
|
||||
else:
|
||||
echo '<td style="display:none;" class="data-venue" data-label="'.__( 'Venue', 'sportspress' ).'" itemprop="location" itemscope itemtype="http://schema.org/Place">';
|
||||
else :
|
||||
echo '<td style="display:none;" class="data-venue" data-label="' . __( 'Venue', 'sportspress' ) . '" itemprop="location" itemscope itemtype="http://schema.org/Place">';
|
||||
echo '<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">';
|
||||
_e( 'N/A', 'sportspress' );
|
||||
echo '</div>';
|
||||
echo '</td>';
|
||||
endif;
|
||||
|
||||
if ( sp_column_active( $usecolumns, 'article' ) ):
|
||||
echo '<td class="data-article" data-label="'.__( 'Article', 'sportspress' ).'">';
|
||||
if ( $link_events ) echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
if ( sp_column_active( $usecolumns, 'article' ) ) :
|
||||
echo '<td class="data-article" data-label="' . __( 'Article', 'sportspress' ) . '">';
|
||||
if ( $link_events ) {
|
||||
echo '<a href="' . get_post_permalink( $event->ID, false, true ) . '" itemprop="url">';
|
||||
}
|
||||
|
||||
if ( $video ):
|
||||
echo '<div class="dashicons dashicons-video-alt"></div>';
|
||||
elseif ( has_post_thumbnail( $event->ID ) ):
|
||||
if ( $video ) :
|
||||
echo '<div class="dashicons dashicons-video-alt"></div>';
|
||||
elseif ( has_post_thumbnail( $event->ID ) ) :
|
||||
echo '<div class="dashicons dashicons-camera"></div>';
|
||||
endif;
|
||||
if ( $event->post_content !== null ):
|
||||
if ( $event->post_status == 'publish' ):
|
||||
if ( $event->post_content !== null ) :
|
||||
if ( $event->post_status == 'publish' ) :
|
||||
_e( 'Recap', 'sportspress' );
|
||||
else:
|
||||
else :
|
||||
_e( 'Preview', 'sportspress' );
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $link_events ) echo '</a>';
|
||||
echo '</td>';
|
||||
if ( $link_events ) {
|
||||
echo '</a>';
|
||||
}
|
||||
echo '</td>';
|
||||
endif;
|
||||
|
||||
if ( sp_column_active( $usecolumns, 'day' ) ):
|
||||
echo '<td class="data-day" data-label="'.__( 'Match Day', 'sportspress' ).'">';
|
||||
if ( sp_column_active( $usecolumns, 'day' ) ) :
|
||||
echo '<td class="data-day" data-label="' . __( 'Match Day', 'sportspress' ) . '">';
|
||||
$day = get_post_meta( $event->ID, 'sp_day', true );
|
||||
if ( '' == $day ) {
|
||||
echo '-';
|
||||
@@ -455,9 +541,9 @@ $identifier = uniqid( 'eventlist_' );
|
||||
|
||||
do_action( 'sportspress_event_list_row', $event, $usecolumns );
|
||||
|
||||
echo '</tr>';
|
||||
echo '</tr>';
|
||||
|
||||
$i++;
|
||||
$i++;
|
||||
endforeach;
|
||||
?>
|
||||
</tbody>
|
||||
@@ -465,8 +551,8 @@ $identifier = uniqid( 'eventlist_' );
|
||||
</div>
|
||||
<?php
|
||||
// If responsive tables are enabled then load the inline css code
|
||||
if ( $responsive ){
|
||||
//sportspress_responsive_tables_css( $identifier );
|
||||
if ( $responsive ) {
|
||||
// sportspress_responsive_tables_css( $identifier );
|
||||
}
|
||||
if ( $id && $show_all_events_link ) {
|
||||
echo '<div class="sp-calendar-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a></div>';
|
||||
|
||||
@@ -2,24 +2,24 @@
|
||||
/**
|
||||
* Event Logos Block
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.7.1
|
||||
*/
|
||||
?>
|
||||
<div class="sp-template sp-template-event-logos sp-template-event-blocks sp-template-event-logos-block">
|
||||
<div class="sp-table-wrapper">
|
||||
<table class="sp-event-blocks sp-data-table" data-sp-rows="1">
|
||||
<thead><tr><th></th></tr></thead> <?php # Required for DataTables ?>
|
||||
<thead><tr><th></th></tr></thead> <?php // Required for DataTables ?>
|
||||
<tbody>
|
||||
<tr class="sp-row sp-post alternate">
|
||||
<td>
|
||||
<?php
|
||||
$j = 0;
|
||||
foreach( $teams as $team ):
|
||||
foreach ( $teams as $team ) :
|
||||
$j++;
|
||||
|
||||
if ( has_post_thumbnail ( $team ) ) {
|
||||
if ( has_post_thumbnail( $team ) ) {
|
||||
$logo = get_the_post_thumbnail( $team, 'sportspress-fit-icon' );
|
||||
} else {
|
||||
$logo = '';
|
||||
@@ -33,12 +33,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
if ( $link_teams ):
|
||||
if ( $link_teams ) :
|
||||
$logo = '<a class="team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) . '" href="' . get_permalink( $team, false, true ) . '" title="' . get_the_title( $team ) . '">' . $logo . '</a>';
|
||||
else:
|
||||
else :
|
||||
$logo = '<span class="team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) . '" title="' . get_the_title( $team ) . '">' . $logo . '</span>';
|
||||
endif;
|
||||
|
||||
|
||||
echo $logo;
|
||||
endforeach;
|
||||
?>
|
||||
@@ -48,7 +48,7 @@
|
||||
<?php
|
||||
|
||||
$status = __( 'Preview', 'sportspress' );
|
||||
|
||||
|
||||
if ( $show_time ) {
|
||||
?>
|
||||
<h5 class="sp-event-results">
|
||||
@@ -56,7 +56,7 @@
|
||||
</h5>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
if ( $show_results && ! empty( $results ) ) {
|
||||
?>
|
||||
<h5 class="sp-event-results">
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
/**
|
||||
* Event Logos Inline
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.6
|
||||
*/
|
||||
|
||||
$team_logos = array();
|
||||
$i = 0;
|
||||
foreach ( $teams as $team ):
|
||||
$i = 0;
|
||||
foreach ( $teams as $team ) :
|
||||
if ( ! has_post_thumbnail( $team ) ) {
|
||||
$logo = '';
|
||||
} else {
|
||||
@@ -28,7 +28,9 @@ foreach ( $teams as $team ):
|
||||
}
|
||||
|
||||
// Add link
|
||||
if ( $link_teams ) $logo = '<a href="' . get_post_permalink( $team ) . '">' . $logo . '</a>';
|
||||
if ( $link_teams ) {
|
||||
$logo = '<a href="' . get_post_permalink( $team ) . '">' . $logo . '</a>';
|
||||
}
|
||||
|
||||
// Add result
|
||||
if ( $show_results && ! empty( $results ) ) {
|
||||
@@ -48,16 +50,16 @@ foreach ( $teams as $team ):
|
||||
}
|
||||
endforeach;
|
||||
$team_logos = array_filter( $team_logos );
|
||||
if ( ! empty( $team_logos ) ):
|
||||
if ( ! empty( $team_logos ) ) :
|
||||
echo '<div class="sp-template sp-template-event-logos sp-template-event-logos-inline"><div class="sp-event-logos sp-event-logos-' . sizeof( $teams ) . '">';
|
||||
|
||||
// Assign delimiter
|
||||
if ( $show_time && sizeof( $teams ) <= 2 ) {
|
||||
$delimiter = '<strong class="sp-event-logos-time sp-team-result">' . apply_filters( 'sportspress_event_time', get_the_time( get_option('time_format'), $id ), $id ) . '</strong>';
|
||||
$delimiter = '<strong class="sp-event-logos-time sp-team-result">' . apply_filters( 'sportspress_event_time', get_the_time( get_option( 'time_format' ), $id ), $id ) . '</strong>';
|
||||
} else {
|
||||
$delimiter = get_option( 'sportspress_event_teams_delimiter', 'vs' );
|
||||
}
|
||||
|
||||
echo implode( ' ' . $delimiter . ' ', $team_logos );
|
||||
echo '</div></div>';
|
||||
endif;
|
||||
endif;
|
||||
|
||||
@@ -2,32 +2,39 @@
|
||||
/**
|
||||
* Event Logos
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.6.10
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( get_option( 'sportspress_event_show_logos', 'yes' ) === 'no' ) return;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
if ( get_option( 'sportspress_event_show_logos', 'yes' ) === 'no' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$teams = (array) get_post_meta( $id, 'sp_team' );
|
||||
$teams = array_filter( $teams, 'sp_filter_positive' );
|
||||
$teams = (array) get_post_meta( $id, 'sp_team' );
|
||||
$teams = array_filter( $teams, 'sp_filter_positive' );
|
||||
$reverse_teams = get_option( 'sportspress_event_reverse_teams', 'no' ) === 'yes' ? true : false;
|
||||
if ( $reverse_teams ) {
|
||||
$teams = array_reverse( $teams );
|
||||
}
|
||||
|
||||
if ( ! $teams ) return;
|
||||
if ( ! $teams ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$layout = get_option( 'sportspress_event_logos_format', 'inline' );
|
||||
|
||||
$show_team_names = get_option( 'sportspress_event_logos_show_team_names', 'yes' ) === 'yes' ? true : false;
|
||||
$show_time = get_option( 'sportspress_event_logos_show_time', 'no' ) === 'yes' ? true : false;
|
||||
$show_results = get_option( 'sportspress_event_logos_show_results', 'no' ) === 'yes' ? true : false;
|
||||
$link_teams = get_option( 'sportspress_link_teams', 'no' ) === 'yes' ? true : false;
|
||||
$show_time = get_option( 'sportspress_event_logos_show_time', 'no' ) === 'yes' ? true : false;
|
||||
$show_results = get_option( 'sportspress_event_logos_show_results', 'no' ) === 'yes' ? true : false;
|
||||
$link_teams = get_option( 'sportspress_link_teams', 'no' ) === 'yes' ? true : false;
|
||||
|
||||
if ( $show_results ) {
|
||||
$results = sp_get_main_results( $id );
|
||||
@@ -43,14 +50,17 @@ if ( $show_results ) {
|
||||
$results = array();
|
||||
}
|
||||
|
||||
sp_get_template( 'event-logos-' . $layout . '.php', array(
|
||||
'id' => $id,
|
||||
'teams' => $teams,
|
||||
'results' => $results,
|
||||
'show_team_names' => $show_team_names,
|
||||
'show_time' => $show_time,
|
||||
'show_results' => $show_results,
|
||||
'link_teams' => $link_teams,
|
||||
) );
|
||||
sp_get_template(
|
||||
'event-logos-' . $layout . '.php',
|
||||
array(
|
||||
'id' => $id,
|
||||
'teams' => $teams,
|
||||
'results' => $results,
|
||||
'show_team_names' => $show_team_names,
|
||||
'show_time' => $show_time,
|
||||
'show_results' => $show_results,
|
||||
'link_teams' => $link_teams,
|
||||
)
|
||||
);
|
||||
|
||||
do_action( 'sportspress_after_event_logos', $id );
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
/**
|
||||
* Event Officials List
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.5
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
||||
?>
|
||||
@@ -18,7 +20,9 @@ $scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'ye
|
||||
<?php
|
||||
foreach ( $labels as $key => $label ) {
|
||||
$appointed_officials = (array) sp_array_value( $data, $key, array() );
|
||||
if ( empty( $appointed_officials ) ) continue;
|
||||
if ( empty( $appointed_officials ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
echo '<dt>' . $label . '</dt>';
|
||||
|
||||
@@ -32,4 +36,4 @@ $scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'ye
|
||||
?>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
/**
|
||||
* Event Officials Table
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.5
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
||||
?>
|
||||
@@ -40,4 +42,4 @@ $scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'ye
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,15 +2,18 @@
|
||||
/**
|
||||
* Event Officials
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.5
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$event = new SP_Event( $id );
|
||||
|
||||
@@ -18,27 +21,35 @@ $event = new SP_Event( $id );
|
||||
$data = $event->appointments();
|
||||
|
||||
// Return if no officials are in event
|
||||
if ( empty( $data ) ) return;
|
||||
if ( empty( $data ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The first row should be column labels
|
||||
$labels = $data[0];
|
||||
unset( $data[0] );
|
||||
|
||||
$link_officials = get_option( 'sportspress_link_officials', 'no' ) == 'yes' ? true : false;
|
||||
$format = get_option( 'sportspress_event_officials_format', 'table' );
|
||||
$format = get_option( 'sportspress_event_officials_format', 'table' );
|
||||
|
||||
switch ( $format ):
|
||||
switch ( $format ) :
|
||||
case 'list':
|
||||
sp_get_template( 'event-officials-list.php', array(
|
||||
'labels' => $labels,
|
||||
'data' => $data,
|
||||
'link_officials' => $link_officials,
|
||||
) );
|
||||
sp_get_template(
|
||||
'event-officials-list.php',
|
||||
array(
|
||||
'labels' => $labels,
|
||||
'data' => $data,
|
||||
'link_officials' => $link_officials,
|
||||
)
|
||||
);
|
||||
break;
|
||||
default:
|
||||
sp_get_template( 'event-officials-table.php', array(
|
||||
'labels' => $labels,
|
||||
'data' => $data,
|
||||
'link_officials' => $link_officials,
|
||||
) );
|
||||
endswitch;
|
||||
sp_get_template(
|
||||
'event-officials-table.php',
|
||||
array(
|
||||
'labels' => $labels,
|
||||
'data' => $data,
|
||||
'link_officials' => $link_officials,
|
||||
)
|
||||
);
|
||||
endswitch;
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
/**
|
||||
* Event Results/Details
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 1.9
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
?>
|
||||
<div class="sp-event-overview">
|
||||
<?php do_action( 'sportspress_event_overview_content' ); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,44 +2,74 @@
|
||||
/**
|
||||
* Event Performance Table
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.6.20
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.6.20
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
// Initialize totals
|
||||
$totals = array();
|
||||
|
||||
// Set null
|
||||
if ( ! isset( $section ) ) $section = -1;
|
||||
if ( ! isset( $section_label ) ) $section_label = null;
|
||||
if ( ! isset( $class ) ) $class = null;
|
||||
if ( ! isset( $section ) ) {
|
||||
$section = -1;
|
||||
}
|
||||
if ( ! isset( $section_label ) ) {
|
||||
$section_label = null;
|
||||
}
|
||||
if ( ! isset( $class ) ) {
|
||||
$class = null;
|
||||
}
|
||||
|
||||
// Initialize arrays
|
||||
if ( ! isset( $lineups ) ) $lineups = array();
|
||||
if ( ! isset( $subs ) ) $subs = array();
|
||||
if ( ! isset( $lineups ) ) {
|
||||
$lineups = array();
|
||||
}
|
||||
if ( ! isset( $subs ) ) {
|
||||
$subs = array();
|
||||
}
|
||||
|
||||
$responsive = get_option( 'sportspress_enable_responsive_tables', 'no' ) == 'yes' ? true : false;
|
||||
//Create a unique identifier based on the current time in microseconds
|
||||
// Create a unique identifier based on the current time in microseconds
|
||||
$identifier = uniqid( 'performance_' );
|
||||
// If responsive tables are enabled then load the inline css code
|
||||
if ( true == $responsive && $mode == 'values' ){
|
||||
//sportspress_responsive_tables_css( $identifier );
|
||||
if ( true == $responsive && $mode == 'values' ) {
|
||||
// sportspress_responsive_tables_css( $identifier );
|
||||
}
|
||||
$i = 0;
|
||||
?>
|
||||
<div class="sp-template sp-template-event-performance sp-template-event-performance-<?php echo $mode; ?><?php if ( isset( $class ) ) { echo ' ' . $class; } ?>">
|
||||
<?php if ( $caption ): ?>
|
||||
<div class="sp-template sp-template-event-performance sp-template-event-performance-<?php echo $mode; ?>
|
||||
<?php
|
||||
if ( isset( $class ) ) {
|
||||
echo ' ' . $class; }
|
||||
?>
|
||||
">
|
||||
<?php if ( $caption ) : ?>
|
||||
<h4 class="sp-table-caption"><?php echo $caption; ?></h4>
|
||||
<?php endif; ?>
|
||||
<div class="sp-table-wrapper">
|
||||
<table class="sp-event-performance sp-data-table<?php if ( $mode == 'values' ) { ?><?php if ( $scrollable ) { ?> sp-scrollable-table<?php }if ( $responsive ) { echo ' sp-responsive-table '.$identifier; } if ( $sortable ) { ?> sp-sortable-table<?php } ?><?php } ?>">
|
||||
<table class="sp-event-performance sp-data-table
|
||||
<?php
|
||||
if ( $mode == 'values' ) {
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ( $scrollable ) {
|
||||
?>
|
||||
sp-scrollable-table
|
||||
<?php
|
||||
}if ( $responsive ) {
|
||||
echo ' sp-responsive-table ' . $identifier; } if ( $sortable ) {
|
||||
?>
|
||||
sp-sortable-table<?php } ?><?php } ?>">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php if ( $mode == 'values' ): ?>
|
||||
<?php if ( $show_players ): ?>
|
||||
<?php if ( $mode == 'values' ) : ?>
|
||||
<?php if ( $show_players ) : ?>
|
||||
<?php if ( apply_filters( 'sportspress_event_performance_show_numbers', $show_numbers, $section ) ) { ?>
|
||||
<th class="data-number">#</th>
|
||||
<?php } ?>
|
||||
@@ -51,24 +81,25 @@ $i = 0;
|
||||
<?php } ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<?php foreach ( $labels as $key => $label ): ?>
|
||||
<?php foreach ( $labels as $key => $label ) : ?>
|
||||
<th class="data-<?php echo $key; ?>"><?php echo $label; ?></th>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php if ( $show_players ): ?>
|
||||
<?php if ( $show_players ) : ?>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
$lineups = array_filter( $data, array( $event, 'lineup_filter' ) );
|
||||
$subs = array_filter( $data, array( $event, 'sub_filter' ) );
|
||||
$subs = array_filter( $data, array( $event, 'sub_filter' ) );
|
||||
|
||||
$lineup_sub_relation = array();
|
||||
foreach ( $subs as $sub_id => $sub ):
|
||||
if ( ! $sub_id )
|
||||
foreach ( $subs as $sub_id => $sub ) :
|
||||
if ( ! $sub_id ) {
|
||||
continue;
|
||||
$i = sp_array_value( $sub, 'sub', 0 );
|
||||
}
|
||||
$i = sp_array_value( $sub, 'sub', 0 );
|
||||
$lineup_sub_relation[ $i ] = $sub_id;
|
||||
endforeach;
|
||||
|
||||
@@ -76,15 +107,17 @@ $i = 0;
|
||||
|
||||
$stars_type = get_option( 'sportspress_event_performance_stars_type', 0 );
|
||||
|
||||
foreach ( $data as $player_id => $row ):
|
||||
foreach ( $data as $player_id => $row ) :
|
||||
|
||||
if ( ! $player_id )
|
||||
if ( ! $player_id ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$name = get_the_title( $player_id );
|
||||
|
||||
if ( ! $name )
|
||||
if ( ! $name ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
echo '<tr class="' . sp_array_value( $row, 'status', 'lineup' ) . ' ' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
||||
|
||||
@@ -95,15 +128,15 @@ $i = 0;
|
||||
echo '<td class="data-number" data-label="#">' . $number . '</td>';
|
||||
}
|
||||
|
||||
if ( $link_posts ):
|
||||
if ( $link_posts ) :
|
||||
$permalink = get_post_permalink( $player_id );
|
||||
$name = '<a href="' . $permalink . '">' . $name . '</a>';
|
||||
$name = '<a href="' . $permalink . '">' . $name . '</a>';
|
||||
endif;
|
||||
|
||||
if ( $stars_type ):
|
||||
if ( $stars_type ) :
|
||||
$player_stars = sp_array_value( $stars, $player_id, 0 );
|
||||
if ( $player_stars ):
|
||||
switch ( $stars_type ):
|
||||
if ( $player_stars ) :
|
||||
switch ( $stars_type ) :
|
||||
case 1:
|
||||
$name .= ' <span class="sp-event-stars"><i class="sp-event-star dashicons dashicons-star-filled" title="' . __( 'Player of the Match', 'sportspress' ) . '"></i></span>';
|
||||
break;
|
||||
@@ -117,88 +150,91 @@ $i = 0;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( array_key_exists( $player_id, $lineup_sub_relation ) ):
|
||||
if ( array_key_exists( $player_id, $lineup_sub_relation ) ) :
|
||||
$name .= ' <span class="sub-in" title="' . get_the_title( $lineup_sub_relation[ $player_id ] ) . '">' . sp_array_value( sp_array_value( $data, $lineup_sub_relation[ $player_id ], array() ), 'number', null ) . '</span>';
|
||||
elseif ( isset( $row['sub'] ) && $row['sub'] ):
|
||||
elseif ( isset( $row['sub'] ) && $row['sub'] ) :
|
||||
$subbed = (int) $row['sub'];
|
||||
$name .= ' <span class="sub-out" title="' . get_the_title( $row[ 'sub' ] ) . '">' . sp_array_value( sp_array_value( $data, $subbed, array() ), 'number', null ) . '</span>';
|
||||
$name .= ' <span class="sub-out" title="' . get_the_title( $row['sub'] ) . '">' . sp_array_value( sp_array_value( $data, $subbed, array() ), 'number', null ) . '</span>';
|
||||
endif;
|
||||
|
||||
$content = '';
|
||||
$content = '';
|
||||
$position = null;
|
||||
|
||||
foreach ( $labels as $key => $label ):
|
||||
if ( 'name' == $key )
|
||||
foreach ( $labels as $key => $label ) :
|
||||
if ( 'name' == $key ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$format = sp_array_value( $formats, $key, 'number' );
|
||||
$format = sp_array_value( $formats, $key, 'number' );
|
||||
$placeholder = sp_get_format_placeholder( $format );
|
||||
|
||||
if ( ! array_key_exists( $key, $totals ) ):
|
||||
if ( ! array_key_exists( $key, $totals ) ) :
|
||||
$totals[ $key ] = $placeholder;
|
||||
endif;
|
||||
|
||||
if ( 'time' === $format ):
|
||||
if ( 'time' === $format ) :
|
||||
$totals[ $key ] = ' ';
|
||||
endif;
|
||||
|
||||
|
||||
$value = '-';
|
||||
if ( $key == 'position' ):
|
||||
if ( $key == 'position' ) :
|
||||
$positions = array();
|
||||
if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
|
||||
if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ) :
|
||||
$position_ids = (array) $row[ $key ];
|
||||
else:
|
||||
else :
|
||||
$position_ids = (array) sp_get_the_term_id( $player_id, 'sp_position' );
|
||||
endif;
|
||||
|
||||
foreach ( $position_ids as $position_id ) {
|
||||
$player_position = get_term_by( 'id', $position_id, 'sp_position' );
|
||||
if ( $player_position ) $positions[] = $player_position->name;
|
||||
if ( $player_position ) {
|
||||
$positions[] = $player_position->name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$positions = array_unique( $positions );
|
||||
|
||||
if ( sizeof( $positions ) ):
|
||||
if ( sizeof( $positions ) ) :
|
||||
$value = $position = implode( ', ', $positions );
|
||||
endif;
|
||||
else:
|
||||
if ( array_key_exists( $key, $row ) && $row[ $key ] !== '' ):
|
||||
if ( 'checkbox' === $format ):
|
||||
else :
|
||||
if ( array_key_exists( $key, $row ) && $row[ $key ] !== '' ) :
|
||||
if ( 'checkbox' === $format ) :
|
||||
$value = '<span class="sp-checkbox">' . $row[ $key ] . '</span>';
|
||||
else:
|
||||
else :
|
||||
$value = $row[ $key ];
|
||||
endif;
|
||||
else:
|
||||
else :
|
||||
$value = $placeholder;
|
||||
endif;
|
||||
|
||||
if ( 'number' === $format ):
|
||||
$add = apply_filters( 'sportspress_event_performance_add_value', floatval( $value ), $key );
|
||||
|
||||
if ( 'number' === $format ) :
|
||||
$add = apply_filters( 'sportspress_event_performance_add_value', floatval( $value ), $key );
|
||||
$totals[ $key ] += $add;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $mode == 'values' ):
|
||||
$content .= '<td class="data-' . $key . '" data-label="'.$labels[$key].'">' . $value . '</td>';
|
||||
elseif ( intval( $value ) && $mode == 'icons' ):
|
||||
if ( $mode == 'values' ) :
|
||||
$content .= '<td class="data-' . $key . '" data-label="' . $labels[ $key ] . '">' . $value . '</td>';
|
||||
elseif ( intval( $value ) && $mode == 'icons' ) :
|
||||
$performance_id = sp_array_value( $performance_ids, $key, null );
|
||||
$icons = '';
|
||||
if ( $performance_id && has_post_thumbnail( $performance_id ) ):
|
||||
$icons = str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $performance_id ) ) ) . ' ', intval($value) );
|
||||
$icons = '';
|
||||
if ( $performance_id && has_post_thumbnail( $performance_id ) ) :
|
||||
$icons = str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $performance_id ) ) ) . ' ', intval( $value ) );
|
||||
endif;
|
||||
$content .= apply_filters( 'sportspress_event_performance_icons', $icons, $performance_id, $value );
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
if ( isset( $position ) && $mode == 'icons' ):
|
||||
if ( isset( $position ) && $mode == 'icons' ) :
|
||||
$name .= ' <small class="sp-player-position">' . $position . '</small>';
|
||||
endif;
|
||||
|
||||
echo '<td class="data-name" data-label="' . ( isset( $section_label ) ? $section_label : __( 'Player', 'sportspress' ) ) .'">' . $name . '</td>';
|
||||
echo '<td class="data-name" data-label="' . ( isset( $section_label ) ? $section_label : __( 'Player', 'sportspress' ) ) . '">' . $name . '</td>';
|
||||
|
||||
if ( $mode == 'icons' ):
|
||||
if ( $mode == 'icons' ) :
|
||||
echo '<td class="sp-performance-icons">' . $content . '</td>';
|
||||
else:
|
||||
else :
|
||||
echo $content;
|
||||
endif;
|
||||
|
||||
@@ -208,17 +244,19 @@ $i = 0;
|
||||
|
||||
endforeach;
|
||||
|
||||
foreach ( $labels as $key => $label ):
|
||||
foreach ( $labels as $key => $label ) :
|
||||
$format = sp_array_value( $formats, $key, 'number' );
|
||||
if ( 'equation' === $format ):
|
||||
if ( 'equation' === $format ) :
|
||||
$post = get_page_by_path( $key, OBJECT, 'sp_performance' );
|
||||
if ( $post ) $totals[ $key ] = sp_solve( get_post_meta( $post->ID, 'sp_equation', true ), $totals, get_post_meta( $post->ID, 'sp_precision', true ) );
|
||||
if ( $post ) {
|
||||
$totals[ $key ] = sp_solve( get_post_meta( $post->ID, 'sp_equation', true ), $totals, get_post_meta( $post->ID, 'sp_precision', true ) );
|
||||
}
|
||||
endif;
|
||||
endforeach;
|
||||
?>
|
||||
</tbody>
|
||||
<?php endif; ?>
|
||||
<?php if ( apply_filters( 'sportspress_event_performance_show_footer', $show_total ) ): ?>
|
||||
<?php if ( apply_filters( 'sportspress_event_performance_show_footer', $show_total ) ) : ?>
|
||||
<<?php echo ( $show_players ? 'tfoot' : 'tbody' ); ?>>
|
||||
<?php
|
||||
do_action( 'sportspress_event_performance_table_footer', $data, $labels, $section, $performance_ids );
|
||||
@@ -226,52 +264,57 @@ $i = 0;
|
||||
?>
|
||||
<tr class="sp-total-row <?php echo ( $i % 2 == 0 ? 'odd' : 'even' ); ?>">
|
||||
<?php
|
||||
if ( $show_players ):
|
||||
if ( $show_players ) :
|
||||
if ( apply_filters( 'sportspress_event_performance_show_numbers', $show_numbers, $section ) ) {
|
||||
echo '<td class="data-number" data-label=" "> </td>';
|
||||
}
|
||||
if ( $mode == 'values' ):
|
||||
if ( $mode == 'values' ) :
|
||||
echo '<td class="data-name" data-label=" ">' . __( 'Total', 'sportspress' ) . '</td>';
|
||||
endif;
|
||||
endif;
|
||||
|
||||
$row = sp_array_value( $data, 0, array() );
|
||||
|
||||
if ( $mode == 'icons' ) echo '<td class="sp-performance-icons" colspan="2">';
|
||||
if ( $mode == 'icons' ) {
|
||||
echo '<td class="sp-performance-icons" colspan="2">';
|
||||
}
|
||||
|
||||
foreach ( $labels as $key => $label ):
|
||||
foreach ( $labels as $key => $label ) :
|
||||
$format = sp_array_value( $formats, $key, 'number' );
|
||||
if ( 'name' == $key )
|
||||
if ( 'name' == $key ) {
|
||||
continue;
|
||||
if ( $key == 'position' ):
|
||||
}
|
||||
if ( $key == 'position' ) :
|
||||
$value = ' ';
|
||||
else:
|
||||
if ( $primary && $key !== $primary ):
|
||||
else :
|
||||
if ( $primary && $key !== $primary ) :
|
||||
$value = ' ';
|
||||
elseif ( 'equation' !== $format && array_key_exists( $key, $row ) && $row[ $key ] != '' ):
|
||||
elseif ( 'equation' !== $format && array_key_exists( $key, $row ) && $row[ $key ] != '' ) :
|
||||
$value = $row[ $key ];
|
||||
else:
|
||||
else :
|
||||
$value = apply_filters( 'sportspress_event_performance_table_total_value', sp_array_value( $totals, $key, 0 ), $data, $key );
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $mode == 'values' ):
|
||||
if ($key == 'position'){
|
||||
if ( $mode == 'values' ) :
|
||||
if ( $key == 'position' ) {
|
||||
echo '<td class="data-' . $key . '" data-label=" ">' . $value . '</td>';
|
||||
}else{
|
||||
echo '<td class="data-' . $key . '" data-label="'.$labels[$key].'">' . $value . '</td>';
|
||||
} else {
|
||||
echo '<td class="data-' . $key . '" data-label="' . $labels[ $key ] . '">' . $value . '</td>';
|
||||
}
|
||||
elseif ( intval( $value ) && $mode == 'icons' ):
|
||||
elseif ( intval( $value ) && $mode == 'icons' ) :
|
||||
$performance_id = sp_array_value( $performance_ids, $key, null );
|
||||
$icons = '';
|
||||
if ( $performance_id && has_post_thumbnail( $performance_id ) ):
|
||||
$icons = '';
|
||||
if ( $performance_id && has_post_thumbnail( $performance_id ) ) :
|
||||
$icons = get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $performance_id ) ) );
|
||||
endif;
|
||||
echo apply_filters( 'sportspress_event_performance_icons', $icons, $performance_id, 1 ) . $value . ' ';
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
if ( $mode == 'icons' ) echo '</td>';
|
||||
if ( $mode == 'icons' ) {
|
||||
echo '</td>';
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
@@ -279,10 +322,16 @@ $i = 0;
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
<?php
|
||||
if ( isset( $show_staff ) ) {
|
||||
echo sp_get_template( 'event-staff.php', array( 'id' => $id, 'index' => $index ) );
|
||||
}
|
||||
if ( isset( $show_staff ) ) {
|
||||
echo sp_get_template(
|
||||
'event-staff.php',
|
||||
array(
|
||||
'id' => $id,
|
||||
'index' => $index,
|
||||
)
|
||||
);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php do_action( 'sportspress_after_event_performance_table', $data, $lineups, $subs, $class ); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,47 +2,52 @@
|
||||
/**
|
||||
* Event Performance
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.6.16
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
$show_players = get_option( 'sportspress_event_show_players', 'yes' ) === 'yes' ? true : false;
|
||||
$show_staff = get_option( 'sportspress_event_show_staff', 'yes' ) === 'yes' ? true : false;
|
||||
$show_total = get_option( 'sportspress_event_show_total', 'yes' ) === 'yes' ? true : false;
|
||||
$show_numbers = get_option( 'sportspress_event_show_player_numbers', 'yes' ) === 'yes' ? true : false;
|
||||
$show_players = get_option( 'sportspress_event_show_players', 'yes' ) === 'yes' ? true : false;
|
||||
$show_staff = get_option( 'sportspress_event_show_staff', 'yes' ) === 'yes' ? true : false;
|
||||
$show_total = get_option( 'sportspress_event_show_total', 'yes' ) === 'yes' ? true : false;
|
||||
$show_numbers = get_option( 'sportspress_event_show_player_numbers', 'yes' ) === 'yes' ? true : false;
|
||||
$show_position = get_option( 'sportspress_event_show_position', 'yes' ) === 'yes' ? true : false;
|
||||
$show_minutes = get_option( 'sportspress_event_performance_show_minutes', 'no' ) === 'yes' ? true : false;
|
||||
$sections = get_option( 'sportspress_event_performance_sections', -1 );
|
||||
$show_minutes = get_option( 'sportspress_event_performance_show_minutes', 'no' ) === 'yes' ? true : false;
|
||||
$sections = get_option( 'sportspress_event_performance_sections', -1 );
|
||||
$reverse_teams = get_option( 'sportspress_event_reverse_teams', 'no' ) === 'yes' ? true : false;
|
||||
$primary = sp_get_main_performance_option();
|
||||
$total = get_option( 'sportspress_event_total_performance', 'all');
|
||||
$primary = sp_get_main_performance_option();
|
||||
$total = get_option( 'sportspress_event_total_performance', 'all' );
|
||||
|
||||
if ( ! $show_players && ! $show_staff && ! $show_total ) return;
|
||||
if ( ! $show_players && ! $show_staff && ! $show_total ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$teams = get_post_meta( $id, 'sp_team', false );
|
||||
|
||||
$is_individual = sp_get_post_mode( $id ) === 'player' ? true : false;
|
||||
|
||||
if ( is_array( $teams ) ):
|
||||
if ( is_array( $teams ) ) :
|
||||
ob_start();
|
||||
|
||||
$event = new SP_Event( $id );
|
||||
$event = new SP_Event( $id );
|
||||
$performance = $event->performance();
|
||||
$stars = $event->stars();
|
||||
$stars = $event->stars();
|
||||
|
||||
$link_posts = get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false;
|
||||
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
||||
$sortable = get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false;
|
||||
$mode = get_option( 'sportspress_event_performance_mode', 'values' );
|
||||
$sortable = get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false;
|
||||
$mode = get_option( 'sportspress_event_performance_mode', 'values' );
|
||||
|
||||
// The first row should be column labels
|
||||
$labels = apply_filters( 'sportspress_event_box_score_labels', $performance[0], $event, $mode );
|
||||
$labels = apply_filters( 'sportspress_event_box_score_labels', $performance[0], $event, $mode );
|
||||
|
||||
// Add position to labels if selected
|
||||
if ( $show_position ) {
|
||||
@@ -55,16 +60,21 @@ if ( is_array( $teams ) ):
|
||||
$performance = array_filter( $performance );
|
||||
|
||||
$status = $event->status();
|
||||
|
||||
|
||||
if ( 'future' == $status ) {
|
||||
$show_total = false;
|
||||
}
|
||||
|
||||
// Get performance ids for icons
|
||||
if ( $mode == 'icons' ):
|
||||
$performance_ids = array();
|
||||
$performance_posts = get_posts( array( 'posts_per_page' => -1, 'post_type' => 'sp_performance' ) );
|
||||
foreach ( $performance_posts as $post ):
|
||||
if ( $mode == 'icons' ) :
|
||||
$performance_ids = array();
|
||||
$performance_posts = get_posts(
|
||||
array(
|
||||
'posts_per_page' => -1,
|
||||
'post_type' => 'sp_performance',
|
||||
)
|
||||
);
|
||||
foreach ( $performance_posts as $post ) :
|
||||
$performance_ids[ $post->post_name ] = $post->ID;
|
||||
endforeach;
|
||||
endif;
|
||||
@@ -72,21 +82,21 @@ if ( is_array( $teams ) ):
|
||||
if ( $reverse_teams ) {
|
||||
$teams = array_reverse( $teams, true );
|
||||
}
|
||||
|
||||
|
||||
// Get performance columns
|
||||
$args = array(
|
||||
'post_type' => 'sp_performance',
|
||||
'numberposts' => 100,
|
||||
'post_type' => 'sp_performance',
|
||||
'numberposts' => 100,
|
||||
'posts_per_page' => 100,
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC',
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC',
|
||||
);
|
||||
|
||||
$columns = get_posts( $args );
|
||||
|
||||
|
||||
// Get formats
|
||||
$formats = array();
|
||||
|
||||
|
||||
// Add to formats
|
||||
foreach ( $columns as $column ) {
|
||||
$format = get_post_meta( $column->ID, 'sp_format', true );
|
||||
@@ -97,63 +107,73 @@ if ( is_array( $teams ) ):
|
||||
}
|
||||
|
||||
do_action( 'sportspress_before_event_performance', $columns );
|
||||
|
||||
|
||||
if ( $is_individual ) {
|
||||
// Combined table
|
||||
$data = array();
|
||||
foreach ( $performance as $players ) {
|
||||
foreach ( $players as $player_id => $player ) {
|
||||
if ( $player_id == 0 ) continue;
|
||||
if ( $player_id == 0 ) {
|
||||
continue;
|
||||
}
|
||||
$data[ $player_id ] = $player;
|
||||
}
|
||||
}
|
||||
|
||||
sp_get_template( 'event-performance-table.php', array(
|
||||
'scrollable' => $scrollable,
|
||||
'sortable' => $sortable,
|
||||
'show_players' => $show_players,
|
||||
'show_numbers' => $show_numbers,
|
||||
'show_minutes' => $show_minutes,
|
||||
'show_total' => $show_total,
|
||||
'caption' => __( 'Box Score', 'sportspress' ),
|
||||
'labels' => $labels,
|
||||
'formats' => $formats,
|
||||
'mode' => $mode,
|
||||
'data' => $data,
|
||||
'event' => $event,
|
||||
'stars' => $stars,
|
||||
'link_posts' => $link_posts,
|
||||
'performance_ids' => isset( $performance_ids ) ? $performance_ids : null,
|
||||
'primary' => 'primary' == $total ? $primary : null,
|
||||
) );
|
||||
|
||||
sp_get_template(
|
||||
'event-performance-table.php',
|
||||
array(
|
||||
'scrollable' => $scrollable,
|
||||
'sortable' => $sortable,
|
||||
'show_players' => $show_players,
|
||||
'show_numbers' => $show_numbers,
|
||||
'show_minutes' => $show_minutes,
|
||||
'show_total' => $show_total,
|
||||
'caption' => __( 'Box Score', 'sportspress' ),
|
||||
'labels' => $labels,
|
||||
'formats' => $formats,
|
||||
'mode' => $mode,
|
||||
'data' => $data,
|
||||
'event' => $event,
|
||||
'stars' => $stars,
|
||||
'link_posts' => $link_posts,
|
||||
'performance_ids' => isset( $performance_ids ) ? $performance_ids : null,
|
||||
'primary' => 'primary' == $total ? $primary : null,
|
||||
)
|
||||
);
|
||||
} else {
|
||||
// Prepare for offense and defense sections
|
||||
if ( -1 != $sections ) {
|
||||
|
||||
|
||||
// Determine order of sections
|
||||
if ( 1 == $sections ) {
|
||||
$section_order = array( 1 => __( 'Defense', 'sportspress' ), 0 => __( 'Offense', 'sportspress' ) );
|
||||
$section_order = array(
|
||||
1 => __( 'Defense', 'sportspress' ),
|
||||
0 => __( 'Offense', 'sportspress' ),
|
||||
);
|
||||
} else {
|
||||
$section_order = array( __( 'Offense', 'sportspress' ), __( 'Defense', 'sportspress' ) );
|
||||
}
|
||||
|
||||
|
||||
// Initialize labels
|
||||
$selected = $labels;
|
||||
$labels = array( array(), array() );
|
||||
|
||||
$labels = array( array(), array() );
|
||||
|
||||
// Add positions if applicable
|
||||
if ( $show_position ) {
|
||||
$labels[0]['position'] = $labels[1]['position'] = __( 'Position', 'sportspress' );
|
||||
}
|
||||
|
||||
// Get labels by section
|
||||
foreach ( $columns as $column ):
|
||||
if ( ! array_key_exists( $column->post_name, $selected ) ) continue;
|
||||
foreach ( $columns as $column ) :
|
||||
if ( ! array_key_exists( $column->post_name, $selected ) ) {
|
||||
continue;
|
||||
}
|
||||
$section = get_post_meta( $column->ID, 'sp_section', true );
|
||||
if ( '' === $section ) {
|
||||
$section = -1;
|
||||
}
|
||||
switch ( $section ):
|
||||
switch ( $section ) :
|
||||
case 1:
|
||||
$labels[1][ $column->post_name ] = $column->post_title;
|
||||
break;
|
||||
@@ -167,47 +187,51 @@ if ( is_array( $teams ) ):
|
||||
endforeach;
|
||||
}
|
||||
|
||||
foreach( $teams as $index => $team_id ) {
|
||||
if ( -1 == $team_id ) continue;
|
||||
foreach ( $teams as $index => $team_id ) {
|
||||
if ( -1 == $team_id ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get results for players in the team
|
||||
$players = sp_array_between( (array)get_post_meta( $id, 'sp_player', false ), 0, $index );
|
||||
$players = sp_array_between( (array) get_post_meta( $id, 'sp_player', false ), 0, $index );
|
||||
$has_players = sizeof( $players ) > 1;
|
||||
|
||||
$players = apply_filters( 'sportspress_event_performance_split_team_players', $players );
|
||||
|
||||
$show_team_players = $show_players && $has_players;
|
||||
|
||||
if ( ! $show_team_players && ! $show_staff && ! $show_total ) continue;
|
||||
if ( ! $show_team_players && ! $show_staff && ! $show_total ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $show_team_players || $show_total ) {
|
||||
if ( -1 != $sections ) {
|
||||
|
||||
|
||||
$data = array();
|
||||
|
||||
$offense = (array)get_post_meta( $id, 'sp_offense', false );
|
||||
$defense = (array)get_post_meta( $id, 'sp_defense', false );
|
||||
|
||||
|
||||
$offense = (array) get_post_meta( $id, 'sp_offense', false );
|
||||
$defense = (array) get_post_meta( $id, 'sp_defense', false );
|
||||
|
||||
if ( sizeof( $offense ) || sizeof( $defense ) ) {
|
||||
// Get results for offensive players in the team
|
||||
$offense = sp_array_between( $offense, 0, $index );
|
||||
$data[0] = sp_array_combine( $offense, sp_array_value( $performance, $team_id, array() ) );
|
||||
|
||||
|
||||
// Get results for defensive players in the team
|
||||
$defense = sp_array_between( $defense, 0, $index );
|
||||
$data[1] = sp_array_combine( $defense, sp_array_value( $performance, $team_id, array() ) );
|
||||
} else {
|
||||
} else {
|
||||
// Get results for all players in the team
|
||||
$players = sp_array_between( (array)get_post_meta( $id, 'sp_player', false ), 0, $index );
|
||||
$players = sp_array_between( (array) get_post_meta( $id, 'sp_player', false ), 0, $index );
|
||||
$data[0] = $data[1] = sp_array_combine( $players, sp_array_value( $performance, $team_id, array() ) );
|
||||
}
|
||||
|
||||
|
||||
$s = 0;
|
||||
|
||||
|
||||
foreach ( $section_order as $section_id => $section_label ) {
|
||||
if ( sizeof( $data[ $section_id ] ) ) {
|
||||
if ( 1 == $section_id ) {
|
||||
$order = (array)get_post_meta( $id, 'sp_order', true );
|
||||
$order = (array) get_post_meta( $id, 'sp_order', true );
|
||||
if ( is_array( $order ) && sizeof( $order ) ) {
|
||||
$player_order = sp_array_value( $order, $team_id, array() );
|
||||
if ( is_array( $player_order ) && sizeof( $player_order ) ) {
|
||||
@@ -215,33 +239,36 @@ if ( is_array( $teams ) ):
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sp_get_template( 'event-performance-table.php', array(
|
||||
'id' => $id,
|
||||
'index' => $index,
|
||||
'section' => $section_id,
|
||||
'section_label' => $section_label,
|
||||
'scrollable' => $scrollable,
|
||||
'sortable' => $sortable,
|
||||
'show_players' => $show_team_players,
|
||||
'show_numbers' => $show_numbers,
|
||||
'show_minutes' => $show_minutes,
|
||||
'show_total' => $show_total,
|
||||
'caption' => 0 == $s && $team_id ? sp_team_short_name( $team_id ) : null,
|
||||
'labels' => $labels[ $section_id ],
|
||||
'formats' => $formats,
|
||||
'mode' => $mode,
|
||||
'data' => $data[ $section_id ],
|
||||
'event' => $event,
|
||||
'stars' => $stars,
|
||||
'link_posts' => $link_posts,
|
||||
'performance_ids' => isset( $performance_ids ) ? $performance_ids : null,
|
||||
'primary' => 'primary' == $total ? $primary : null,
|
||||
'class' => 'sp-template-event-performance-team-' . $index . ' sp-template-event-performance-section sp-template-event-performance-section-' . $section_id . ' sp-template-event-performance-team-' . $index . '-section-' . $section_id,
|
||||
'show_staff' => $show_staff,
|
||||
) );
|
||||
|
||||
sp_get_template(
|
||||
'event-performance-table.php',
|
||||
array(
|
||||
'id' => $id,
|
||||
'index' => $index,
|
||||
'section' => $section_id,
|
||||
'section_label' => $section_label,
|
||||
'scrollable' => $scrollable,
|
||||
'sortable' => $sortable,
|
||||
'show_players' => $show_team_players,
|
||||
'show_numbers' => $show_numbers,
|
||||
'show_minutes' => $show_minutes,
|
||||
'show_total' => $show_total,
|
||||
'caption' => 0 == $s && $team_id ? sp_team_short_name( $team_id ) : null,
|
||||
'labels' => $labels[ $section_id ],
|
||||
'formats' => $formats,
|
||||
'mode' => $mode,
|
||||
'data' => $data[ $section_id ],
|
||||
'event' => $event,
|
||||
'stars' => $stars,
|
||||
'link_posts' => $link_posts,
|
||||
'performance_ids' => isset( $performance_ids ) ? $performance_ids : null,
|
||||
'primary' => 'primary' == $total ? $primary : null,
|
||||
'class' => 'sp-template-event-performance-team-' . $index . ' sp-template-event-performance-section sp-template-event-performance-section-' . $section_id . ' sp-template-event-performance-team-' . $index . '-section-' . $section_id,
|
||||
'show_staff' => $show_staff,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$s++;
|
||||
}
|
||||
} else {
|
||||
@@ -257,28 +284,31 @@ if ( is_array( $teams ) ):
|
||||
} else {
|
||||
$data = sp_array_value( array_values( $performance ), $index );
|
||||
}
|
||||
|
||||
sp_get_template( 'event-performance-table.php', array(
|
||||
'id' => $id,
|
||||
'index' => $index,
|
||||
'scrollable' => $scrollable,
|
||||
'sortable' => $sortable,
|
||||
'show_players' => $show_team_players,
|
||||
'show_staff' => $show_staff,
|
||||
'show_numbers' => $show_numbers,
|
||||
'show_minutes' => $show_minutes,
|
||||
'show_total' => $show_total,
|
||||
'caption' => $team_id ? sp_team_short_name( $team_id ) : null,
|
||||
'labels' => $labels,
|
||||
'formats' => $formats,
|
||||
'mode' => $mode,
|
||||
'data' => $data,
|
||||
'event' => $event,
|
||||
'stars' => $stars,
|
||||
'link_posts' => $link_posts,
|
||||
'performance_ids' => isset( $performance_ids ) ? $performance_ids : null,
|
||||
'primary' => 'primary' == $total ? $primary : null,
|
||||
) );
|
||||
|
||||
sp_get_template(
|
||||
'event-performance-table.php',
|
||||
array(
|
||||
'id' => $id,
|
||||
'index' => $index,
|
||||
'scrollable' => $scrollable,
|
||||
'sortable' => $sortable,
|
||||
'show_players' => $show_team_players,
|
||||
'show_staff' => $show_staff,
|
||||
'show_numbers' => $show_numbers,
|
||||
'show_minutes' => $show_minutes,
|
||||
'show_total' => $show_total,
|
||||
'caption' => $team_id ? sp_team_short_name( $team_id ) : null,
|
||||
'labels' => $labels,
|
||||
'formats' => $formats,
|
||||
'mode' => $mode,
|
||||
'data' => $data,
|
||||
'event' => $event,
|
||||
'stars' => $stars,
|
||||
'link_posts' => $link_posts,
|
||||
'performance_ids' => isset( $performance_ids ) ? $performance_ids : null,
|
||||
'primary' => 'primary' == $total ? $primary : null,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,7 +322,7 @@ if ( is_array( $teams ) ):
|
||||
|
||||
$content = trim( $content );
|
||||
|
||||
if ( ! empty( $content ) ):
|
||||
if ( ! empty( $content ) ) :
|
||||
?>
|
||||
<div class="sp-event-performance-tables sp-event-performance-teams">
|
||||
<?php echo $content; ?>
|
||||
|
||||
@@ -2,23 +2,32 @@
|
||||
/**
|
||||
* Event Results
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.7.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( get_option( 'sportspress_event_show_results', 'yes' ) === 'no' ) return;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
if ( get_option( 'sportspress_event_show_results', 'yes' ) === 'no' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$event = new SP_Event( $id );
|
||||
$event = new SP_Event( $id );
|
||||
$status = $event->status();
|
||||
|
||||
if ( 'results' != $status ) return;
|
||||
if ( 'results' != $status ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $caption ) ) $caption = __( 'Results', 'sportspress' );
|
||||
if ( ! isset( $caption ) ) {
|
||||
$caption = __( 'Results', 'sportspress' );
|
||||
}
|
||||
|
||||
// Get event result data
|
||||
$data = $event->results();
|
||||
@@ -31,17 +40,18 @@ unset( $data[0] );
|
||||
|
||||
$data = array_filter( $data );
|
||||
|
||||
if ( empty( $data ) )
|
||||
if ( empty( $data ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
||||
$link_teams = get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false;
|
||||
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
||||
$link_teams = get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false;
|
||||
$show_outcomes = array_key_exists( 'outcome', $labels );
|
||||
|
||||
// Initialize
|
||||
$output = '';
|
||||
$output = '';
|
||||
$table_rows = '';
|
||||
$i = 0;
|
||||
$i = 0;
|
||||
|
||||
// Reverse teams order if the option "Events > Teams > Order > Reverse order" is enabled.
|
||||
$reverse_teams = get_option( 'sportspress_event_reverse_teams', 'no' ) === 'yes' ? true : false;
|
||||
@@ -49,16 +59,16 @@ if ( $reverse_teams ) {
|
||||
$data = array_reverse( $data, true );
|
||||
}
|
||||
|
||||
foreach( $data as $team_id => $result ):
|
||||
if ( $show_outcomes ):
|
||||
$outcomes = array();
|
||||
foreach ( $data as $team_id => $result ) :
|
||||
if ( $show_outcomes ) :
|
||||
$outcomes = array();
|
||||
$result_outcome = sp_array_value( $result, 'outcome' );
|
||||
if ( ! is_array( $result_outcome ) ):
|
||||
if ( ! is_array( $result_outcome ) ) :
|
||||
$outcomes = array( '—' );
|
||||
else:
|
||||
foreach( $result_outcome as $outcome ):
|
||||
else :
|
||||
foreach ( $result_outcome as $outcome ) :
|
||||
$the_outcome = get_page_by_path( $outcome, OBJECT, 'sp_outcome' );
|
||||
if ( is_object( $the_outcome ) ):
|
||||
if ( is_object( $the_outcome ) ) :
|
||||
$outcomes[] = $the_outcome->post_title;
|
||||
endif;
|
||||
endforeach;
|
||||
@@ -71,24 +81,25 @@ foreach( $data as $team_id => $result ):
|
||||
|
||||
$team_name = sp_team_short_name( $team_id );
|
||||
|
||||
if ( $link_teams && sp_post_exists( $team_id ) ):
|
||||
if ( $link_teams && sp_post_exists( $team_id ) ) :
|
||||
$team_name = '<a href="' . get_post_permalink( $team_id ) . '">' . $team_name . '</a>';
|
||||
endif;
|
||||
|
||||
$table_rows .= '<td class="data-name">' . $team_name . '</td>';
|
||||
|
||||
foreach( $labels as $key => $label ):
|
||||
if ( in_array( $key, array( 'name', 'outcome' ) ) )
|
||||
foreach ( $labels as $key => $label ) :
|
||||
if ( in_array( $key, array( 'name', 'outcome' ) ) ) {
|
||||
continue;
|
||||
if ( array_key_exists( $key, $result ) && $result[ $key ] != '' ):
|
||||
}
|
||||
if ( array_key_exists( $key, $result ) && $result[ $key ] != '' ) :
|
||||
$value = $result[ $key ];
|
||||
else:
|
||||
else :
|
||||
$value = apply_filters( 'sportspress_event_empty_result_string', '—' );
|
||||
endif;
|
||||
$table_rows .= '<td class="data-' . $key . '">' . $value . '</td>';
|
||||
endforeach;
|
||||
|
||||
if ( $show_outcomes ):
|
||||
if ( $show_outcomes ) :
|
||||
$table_rows .= '<td class="data-outcome">' . implode( ', ', $outcomes ) . '</td>';
|
||||
endif;
|
||||
|
||||
@@ -97,18 +108,18 @@ foreach( $data as $team_id => $result ):
|
||||
$i++;
|
||||
endforeach;
|
||||
|
||||
if ( empty( $table_rows ) ):
|
||||
if ( empty( $table_rows ) ) :
|
||||
|
||||
return false;
|
||||
|
||||
else:
|
||||
else :
|
||||
|
||||
$output .= '<h4 class="sp-table-caption">' . $caption . '</h4>';
|
||||
|
||||
$output .= '<div class="sp-table-wrapper">' .
|
||||
'<table class="sp-event-results sp-data-table' . ( $scrollable ? ' sp-scrollable-table' : '' ) . '"><thead>' .
|
||||
'<th class="data-name">' . __( 'Team', 'sportspress' ) . '</th>';
|
||||
foreach( $labels as $key => $label ):
|
||||
foreach ( $labels as $key => $label ) :
|
||||
$output .= '<th class="data-' . $key . '">' . $label . '</th>';
|
||||
endforeach;
|
||||
$output .= '</tr>' . '</thead>' . '<tbody>';
|
||||
|
||||
@@ -2,53 +2,59 @@
|
||||
/**
|
||||
* Event Staff
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.5
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
$defaults = array(
|
||||
'id' => get_the_ID(),
|
||||
'index' => 0,
|
||||
'id' => get_the_ID(),
|
||||
'index' => 0,
|
||||
'link_posts' => get_option( 'sportspress_link_staff', 'yes' ) == 'yes' ? true : false,
|
||||
);
|
||||
|
||||
$staffs = array_filter( sp_array_between( (array)get_post_meta( $id, 'sp_staff', false ), 0, $index ) );
|
||||
$staffs = array_filter( sp_array_between( (array) get_post_meta( $id, 'sp_staff', false ), 0, $index ) );
|
||||
|
||||
if ( ! $staffs ) return;
|
||||
if ( ! $staffs ) {
|
||||
return;
|
||||
}
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
?>
|
||||
<div class="sp-template sp-template-event-staff">
|
||||
<p class="sp-event-staff">
|
||||
<?php
|
||||
foreach( $staffs as $staff_id ):
|
||||
foreach ( $staffs as $staff_id ) :
|
||||
|
||||
if ( ! $staff_id )
|
||||
if ( ! $staff_id ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$name = get_the_title( $staff_id );
|
||||
|
||||
if ( ! $name )
|
||||
if ( ! $name ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$staff = new SP_Staff( $staff_id );
|
||||
|
||||
$roles = $staff->roles();
|
||||
if ( ! empty( $roles ) ):
|
||||
if ( ! empty( $roles ) ) :
|
||||
$roles = wp_list_pluck( $roles, 'name' );
|
||||
echo implode( '<span class="sp-staff-role-delimiter">/</span>', $roles );
|
||||
else:
|
||||
else :
|
||||
_e( 'Staff', 'sportspress' );
|
||||
endif;
|
||||
|
||||
echo ': ';
|
||||
|
||||
if ( $link_posts ):
|
||||
if ( $link_posts ) :
|
||||
$permalink = get_post_permalink( $staff_id );
|
||||
$name = '<a href="' . $permalink . '">' . $name . '</a>';
|
||||
$name = '<a href="' . $permalink . '">' . $name . '</a>';
|
||||
endif;
|
||||
|
||||
echo $name . '<br>';
|
||||
@@ -56,4 +62,4 @@ extract( $defaults, EXTR_SKIP );
|
||||
endforeach;
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,32 +2,39 @@
|
||||
/**
|
||||
* Event Venue
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.7.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( get_option( 'sportspress_event_show_venue', 'yes' ) === 'no' ) return;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
if ( get_option( 'sportspress_event_show_venue', 'yes' ) === 'no' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$venues = get_the_terms( $id, 'sp_venue' );
|
||||
|
||||
if ( ! $venues )
|
||||
if ( ! $venues ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$show_maps = get_option( 'sportspress_event_show_maps', 'yes' ) == 'yes' ? true : false;
|
||||
$show_maps = get_option( 'sportspress_event_show_maps', 'yes' ) == 'yes' ? true : false;
|
||||
$link_venues = get_option( 'sportspress_link_venues', 'no' ) == 'yes' ? true : false;
|
||||
|
||||
foreach( $venues as $venue ):
|
||||
foreach ( $venues as $venue ) :
|
||||
$t_id = $venue->term_id;
|
||||
$meta = get_option( "taxonomy_$t_id" );
|
||||
|
||||
$name = $venue->name;
|
||||
if ( $link_venues )
|
||||
if ( $link_venues ) {
|
||||
$name = '<a href="' . get_term_link( $t_id, 'sp_venue' ) . '">' . $name . '</a>';
|
||||
}
|
||||
|
||||
$address = sp_array_value( $meta, 'sp_address', null );
|
||||
$address = urlencode( $address );
|
||||
@@ -40,7 +47,7 @@ foreach( $venues as $venue ):
|
||||
<th><?php echo $name; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php if ( $show_maps ): ?>
|
||||
<?php if ( $show_maps ) : ?>
|
||||
<tbody>
|
||||
<tr class="sp-event-venue-map-row">
|
||||
<td><?php sp_get_template( 'venue-map.php', array( 'meta' => $meta ) ); ?></td>
|
||||
|
||||
@@ -2,26 +2,29 @@
|
||||
/**
|
||||
* Event Video
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 1.4
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$video_url = get_post_meta( $id, 'sp_video', true );
|
||||
if ( $video_url ):
|
||||
if ( $video_url ) :
|
||||
?>
|
||||
<div class="sp-template sp-template-event-video sp-event-video">
|
||||
<h4 class="sp-table-caption"><?php _e( 'Video', 'sportspress' ); ?></h4>
|
||||
<?php
|
||||
global $wp_embed;
|
||||
echo $wp_embed->autoembed( $video_url );
|
||||
?>
|
||||
global $wp_embed;
|
||||
echo $wp_embed->autoembed( $video_url );
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -2,28 +2,30 @@
|
||||
/**
|
||||
* League Table
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.7
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
$defaults = array(
|
||||
'id' => get_the_ID(),
|
||||
'number' => -1,
|
||||
'columns' => null,
|
||||
'highlight' => null,
|
||||
'id' => get_the_ID(),
|
||||
'number' => -1,
|
||||
'columns' => null,
|
||||
'highlight' => null,
|
||||
'show_full_table_link' => false,
|
||||
'title' => false,
|
||||
'show_title' => get_option( 'sportspress_table_show_title', 'yes' ) == 'yes' ? true : false,
|
||||
'show_team_logo' => get_option( 'sportspress_table_show_logos', 'yes' ) == 'yes' ? true : false,
|
||||
'link_posts' => null,
|
||||
'responsive' => get_option( 'sportspress_enable_responsive_tables', 'no' ) == 'yes' ? true : false,
|
||||
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
'paginated' => get_option( 'sportspress_table_paginated', 'yes' ) == 'yes' ? true : false,
|
||||
'rows' => get_option( 'sportspress_table_rows', 10 ),
|
||||
'title' => false,
|
||||
'show_title' => get_option( 'sportspress_table_show_title', 'yes' ) == 'yes' ? true : false,
|
||||
'show_team_logo' => get_option( 'sportspress_table_show_logos', 'yes' ) == 'yes' ? true : false,
|
||||
'link_posts' => null,
|
||||
'responsive' => get_option( 'sportspress_enable_responsive_tables', 'no' ) == 'yes' ? true : false,
|
||||
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
'paginated' => get_option( 'sportspress_table_paginated', 'yes' ) == 'yes' ? true : false,
|
||||
'rows' => get_option( 'sportspress_table_rows', 10 ),
|
||||
);
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
@@ -36,72 +38,81 @@ if ( ! isset( $link_posts ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! isset( $highlight ) ) $highlight = get_post_meta( $id, 'sp_highlight', true );
|
||||
if ( ! isset( $highlight ) ) {
|
||||
$highlight = get_post_meta( $id, 'sp_highlight', true );
|
||||
}
|
||||
|
||||
$table = new SP_League_Table( $id );
|
||||
|
||||
if ( $show_title && false === $title && $id ):
|
||||
if ( $show_title && false === $title && $id ) :
|
||||
$caption = $table->caption;
|
||||
if ( $caption )
|
||||
if ( $caption ) {
|
||||
$title = $caption;
|
||||
else
|
||||
} else {
|
||||
$title = get_the_title( $id );
|
||||
}
|
||||
endif;
|
||||
|
||||
//Check if we have event status sent from shortcode
|
||||
if ( isset( $show_published_events ) )
|
||||
$table->show_published_events = $show_published_events ;
|
||||
// Check if we have event status sent from shortcode
|
||||
if ( isset( $show_published_events ) ) {
|
||||
$table->show_published_events = $show_published_events;
|
||||
}
|
||||
|
||||
if ( isset( $show_future_events ) )
|
||||
$table->show_future_events = $show_future_events ;
|
||||
if ( isset( $show_future_events ) ) {
|
||||
$table->show_future_events = $show_future_events;
|
||||
}
|
||||
|
||||
//Create a unique identifier based on the current time in microseconds
|
||||
// Create a unique identifier based on the current time in microseconds
|
||||
$identifier = uniqid( 'table_' );
|
||||
|
||||
$output = '';
|
||||
|
||||
if ( $title )
|
||||
if ( $title ) {
|
||||
$output .= '<h4 class="sp-table-caption">' . $title . '</h4>';
|
||||
}
|
||||
|
||||
$output .= '<div class="sp-table-wrapper">';
|
||||
|
||||
$output .= '<table class="sp-league-table sp-data-table' . ( $sortable ? ' sp-sortable-table' : '' ) . ( $responsive ? ' sp-responsive-table '.$identifier : '' ). ( $scrollable ? ' sp-scrollable-table' : '' ) . ( $paginated ? ' sp-paginated-table' : '' ) . '" data-sp-rows="' . $rows . '">' . '<thead>' . '<tr>';
|
||||
$output .= '<table class="sp-league-table sp-data-table' . ( $sortable ? ' sp-sortable-table' : '' ) . ( $responsive ? ' sp-responsive-table ' . $identifier : '' ) . ( $scrollable ? ' sp-scrollable-table' : '' ) . ( $paginated ? ' sp-paginated-table' : '' ) . '" data-sp-rows="' . $rows . '">' . '<thead>' . '<tr>';
|
||||
|
||||
$data = $table->data();
|
||||
|
||||
// The first row should be column labels
|
||||
$labels = $data[0];
|
||||
// If responsive tables are enabled then load the inline css code
|
||||
if ( true == $responsive ){
|
||||
//sportspress_responsive_tables_css( $identifier );
|
||||
if ( true == $responsive ) {
|
||||
// sportspress_responsive_tables_css( $identifier );
|
||||
}
|
||||
// Remove the first row to leave us with the actual data
|
||||
unset( $data[0] );
|
||||
|
||||
if ( $columns === null )
|
||||
if ( $columns === null ) {
|
||||
$columns = get_post_meta( $id, 'sp_columns', true );
|
||||
}
|
||||
|
||||
if ( null !== $columns && ! is_array( $columns ) )
|
||||
if ( null !== $columns && ! is_array( $columns ) ) {
|
||||
$columns = explode( ',', $columns );
|
||||
}
|
||||
|
||||
$output .= '<th class="data-rank">' . __( 'Pos', 'sportspress' ) . '</th>';
|
||||
|
||||
foreach( $labels as $key => $label ):
|
||||
if ( ! is_array( $columns ) || $key == 'name' || in_array( $key, $columns ) )
|
||||
foreach ( $labels as $key => $label ) :
|
||||
if ( ! is_array( $columns ) || $key == 'name' || in_array( $key, $columns ) ) {
|
||||
$output .= '<th class="data-' . $key . '">' . $label . '</th>';
|
||||
}
|
||||
endforeach;
|
||||
|
||||
$output .= '</tr>' . '</thead>' . '<tbody>';
|
||||
|
||||
$i = 0;
|
||||
$i = 0;
|
||||
$start = 0;
|
||||
|
||||
if ( intval( $number ) > 0 ):
|
||||
if ( intval( $number ) > 0 ) :
|
||||
$limit = $number;
|
||||
|
||||
// Trim table to center around highlighted team
|
||||
if ( $highlight && sizeof( $data ) > $limit && array_key_exists( $highlight, $data ) ):
|
||||
|
||||
if ( $highlight && sizeof( $data ) > $limit && array_key_exists( $highlight, $data ) ) :
|
||||
|
||||
// Number of teams in the table
|
||||
$size = sizeof( $data );
|
||||
|
||||
@@ -110,16 +121,20 @@ if ( intval( $number ) > 0 ):
|
||||
|
||||
// Get starting position
|
||||
$start = $key - ceil( $limit / 2 ) + 1;
|
||||
if ( $start < 0 ) $start = 0;
|
||||
if ( $start < 0 ) {
|
||||
$start = 0;
|
||||
}
|
||||
|
||||
// Trim table using starting position
|
||||
$trimmed = array_slice( $data, $start, $limit, true );
|
||||
|
||||
// Move starting position if we are too far down the table
|
||||
if ( sizeof( $trimmed ) < $limit && sizeof( $trimmed ) < $size ):
|
||||
if ( sizeof( $trimmed ) < $limit && sizeof( $trimmed ) < $size ) :
|
||||
$offset = $limit - sizeof( $trimmed );
|
||||
$start -= $offset;
|
||||
if ( $start < 0 ) $start = 0;
|
||||
if ( $start < 0 ) {
|
||||
$start = 0;
|
||||
}
|
||||
$trimmed = array_slice( $data, $start, $limit, true );
|
||||
endif;
|
||||
|
||||
@@ -129,16 +144,20 @@ if ( intval( $number ) > 0 ):
|
||||
endif;
|
||||
|
||||
// Loop through the teams
|
||||
foreach ( $data as $team_id => $row ):
|
||||
foreach ( $data as $team_id => $row ) :
|
||||
|
||||
if ( isset( $limit ) && $i >= $limit ) continue;
|
||||
if ( isset( $limit ) && $i >= $limit ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$name = sp_array_value( $row, 'name', null );
|
||||
if ( ! $name ) continue;
|
||||
if ( ! $name ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Generate tags for highlighted team
|
||||
$tr_class = $td_class = '';
|
||||
if ( $highlight == $team_id ):
|
||||
if ( $highlight == $team_id ) :
|
||||
$tr_class = ' highlighted';
|
||||
$td_class = ' sp-highlight';
|
||||
endif;
|
||||
@@ -146,30 +165,32 @@ foreach ( $data as $team_id => $row ):
|
||||
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . $tr_class . ' sp-row-no-' . $i . '">';
|
||||
|
||||
// Rank
|
||||
$output .= '<td class="data-rank' . $td_class . '" data-label="'.$labels['pos'].'">' . sp_array_value( $row, 'pos' ) . '</td>';
|
||||
$output .= '<td class="data-rank' . $td_class . '" data-label="' . $labels['pos'] . '">' . sp_array_value( $row, 'pos' ) . '</td>';
|
||||
|
||||
$name_class = '';
|
||||
|
||||
if ( $show_team_logo ):
|
||||
if ( has_post_thumbnail( $team_id ) ):
|
||||
$logo = get_the_post_thumbnail( $team_id, 'sportspress-fit-icon' );
|
||||
$name = '<span class="team-logo">' . $logo . '</span>' . $name;
|
||||
if ( $show_team_logo ) :
|
||||
if ( has_post_thumbnail( $team_id ) ) :
|
||||
$logo = get_the_post_thumbnail( $team_id, 'sportspress-fit-icon' );
|
||||
$name = '<span class="team-logo">' . $logo . '</span>' . $name;
|
||||
$name_class .= ' has-logo';
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $link_posts ):
|
||||
if ( $link_posts ) :
|
||||
$permalink = get_post_permalink( $team_id );
|
||||
$name = '<a href="' . $permalink . '">' . $name . '</a>';
|
||||
$name = '<a href="' . $permalink . '">' . $name . '</a>';
|
||||
endif;
|
||||
|
||||
$output .= '<td class="data-name' . $name_class . $td_class . '" data-label="'.$labels['name'].'">' . $name . '</td>';
|
||||
$output .= '<td class="data-name' . $name_class . $td_class . '" data-label="' . $labels['name'] . '">' . $name . '</td>';
|
||||
|
||||
foreach( $labels as $key => $value ):
|
||||
if ( in_array( $key, array( 'pos', 'name' ) ) )
|
||||
foreach ( $labels as $key => $value ) :
|
||||
if ( in_array( $key, array( 'pos', 'name' ) ) ) {
|
||||
continue;
|
||||
if ( ! is_array( $columns ) || in_array( $key, $columns ) )
|
||||
$output .= '<td class="data-' . $key . $td_class . '" data-label="'.$labels[$key].'">' . sp_array_value( $row, $key, '—' ) . '</td>';
|
||||
}
|
||||
if ( ! is_array( $columns ) || in_array( $key, $columns ) ) {
|
||||
$output .= '<td class="data-' . $key . $td_class . '" data-label="' . $labels[ $key ] . '">' . sp_array_value( $row, $key, '—' ) . '</td>';
|
||||
}
|
||||
endforeach;
|
||||
|
||||
$output .= '</tr>';
|
||||
@@ -183,8 +204,9 @@ $output .= '</tbody>' . '</table>';
|
||||
|
||||
$output .= '</div>';
|
||||
|
||||
if ( $show_full_table_link )
|
||||
if ( $show_full_table_link ) {
|
||||
$output .= '<div class="sp-league-table-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View full table', 'sportspress' ) . '</a></div>';
|
||||
}
|
||||
?>
|
||||
<div class="sp-template sp-template-league-table">
|
||||
<?php echo $output; ?>
|
||||
|
||||
@@ -2,28 +2,33 @@
|
||||
/**
|
||||
* Official Details
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.7.9
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( get_option( 'sportspress_official_show_details', 'yes' ) === 'no' ) return;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
if ( get_option( 'sportspress_official_show_details', 'yes' ) === 'no' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$defaults = array(
|
||||
'show_number' => get_option( 'sportspress_official_show_number', 'no' ) == 'yes' ? true : false,
|
||||
'show_name' => get_option( 'sportspress_official_show_name', 'no' ) == 'yes' ? true : false,
|
||||
'show_nationality' => get_option( 'sportspress_official_show_nationality', 'yes' ) == 'yes' ? true : false,
|
||||
'show_positions' => get_option( 'sportspress_official_show_positions', 'yes' ) == 'yes' ? true : false,
|
||||
'show_current_teams' => get_option( 'sportspress_official_show_current_teams', 'yes' ) == 'yes' ? true : false,
|
||||
'show_past_teams' => get_option( 'sportspress_official_show_past_teams', 'yes' ) == 'yes' ? true : false,
|
||||
'show_leagues' => get_option( 'sportspress_official_show_leagues', 'no' ) == 'yes' ? true : false,
|
||||
'show_seasons' => get_option( 'sportspress_official_show_seasons', 'no' ) == 'yes' ? true : false,
|
||||
'show_number' => get_option( 'sportspress_official_show_number', 'no' ) == 'yes' ? true : false,
|
||||
'show_name' => get_option( 'sportspress_official_show_name', 'no' ) == 'yes' ? true : false,
|
||||
'show_nationality' => get_option( 'sportspress_official_show_nationality', 'yes' ) == 'yes' ? true : false,
|
||||
'show_positions' => get_option( 'sportspress_official_show_positions', 'yes' ) == 'yes' ? true : false,
|
||||
'show_current_teams' => get_option( 'sportspress_official_show_current_teams', 'yes' ) == 'yes' ? true : false,
|
||||
'show_past_teams' => get_option( 'sportspress_official_show_past_teams', 'yes' ) == 'yes' ? true : false,
|
||||
'show_leagues' => get_option( 'sportspress_official_show_leagues', 'no' ) == 'yes' ? true : false,
|
||||
'show_seasons' => get_option( 'sportspress_official_show_seasons', 'no' ) == 'yes' ? true : false,
|
||||
'show_nationality_flags' => get_option( 'sportspress_official_show_flags', 'yes' ) == 'yes' ? true : false,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
);
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
@@ -33,35 +38,35 @@ $countries = SP()->countries->countries;
|
||||
$official = new SP_Official( $id );
|
||||
|
||||
$metrics_before = $official->metrics( true );
|
||||
$metrics_after = $official->metrics( false );
|
||||
$metrics_after = $official->metrics( false );
|
||||
|
||||
$common = array();
|
||||
|
||||
if ( $show_number ):
|
||||
$common[ '#' ] = $official->number;
|
||||
if ( $show_number ) :
|
||||
$common['#'] = $official->number;
|
||||
endif;
|
||||
|
||||
if ( $show_name ):
|
||||
if ( $show_name ) :
|
||||
$common[ __( 'Name', 'sportspress' ) ] = $official->post->post_title;
|
||||
endif;
|
||||
|
||||
if ( $show_nationality ):
|
||||
if ( $show_nationality ) :
|
||||
$nationalities = $official->nationalities();
|
||||
if ( $nationalities && is_array( $nationalities ) ):
|
||||
if ( $nationalities && is_array( $nationalities ) ) :
|
||||
$values = array();
|
||||
foreach ( $nationalities as $nationality ):
|
||||
foreach ( $nationalities as $nationality ) :
|
||||
$country_name = sp_array_value( $countries, $nationality, null );
|
||||
$values[] = $country_name ? ( $show_nationality_flags ? sp_flags( $nationality ) : '' ) . $country_name : '—';
|
||||
$values[] = $country_name ? ( $show_nationality_flags ? sp_flags( $nationality ) : '' ) . $country_name : '—';
|
||||
endforeach;
|
||||
$common[ __( 'Nationality', 'sportspress' ) ] = implode( '<br>', $values );
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $show_positions ):
|
||||
if ( $show_positions ) :
|
||||
$positions = $official->positions();
|
||||
if ( $positions && is_array( $positions ) ):
|
||||
if ( $positions && is_array( $positions ) ) :
|
||||
$position_names = array();
|
||||
foreach ( $positions as $position ):
|
||||
foreach ( $positions as $position ) :
|
||||
$position_names[] = $position->name;
|
||||
endforeach;
|
||||
$common[ __( 'Position', 'sportspress' ) ] = implode( ', ', $position_names );
|
||||
@@ -70,35 +75,39 @@ endif;
|
||||
|
||||
$data = array_merge( $metrics_before, $common, $metrics_after );
|
||||
|
||||
if ( $show_current_teams ):
|
||||
if ( $show_current_teams ) :
|
||||
$current_teams = $official->current_teams();
|
||||
if ( $current_teams ):
|
||||
if ( $current_teams ) :
|
||||
$teams = array();
|
||||
foreach ( $current_teams as $team ):
|
||||
foreach ( $current_teams as $team ) :
|
||||
$team_name = sp_team_short_name( $team );
|
||||
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
if ( $link_teams ) {
|
||||
$team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
}
|
||||
$teams[] = $team_name;
|
||||
endforeach;
|
||||
$data[ __( 'Current Team', 'sportspress' ) ] = implode( ', ', $teams );
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $show_past_teams ):
|
||||
if ( $show_past_teams ) :
|
||||
$past_teams = $official->past_teams();
|
||||
if ( $past_teams ):
|
||||
if ( $past_teams ) :
|
||||
$teams = array();
|
||||
foreach ( $past_teams as $team ):
|
||||
foreach ( $past_teams as $team ) :
|
||||
$team_name = sp_team_short_name( $team );
|
||||
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
if ( $link_teams ) {
|
||||
$team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
}
|
||||
$teams[] = $team_name;
|
||||
endforeach;
|
||||
$data[ __( 'Past Teams', 'sportspress' ) ] = implode( ', ', $teams );
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $show_leagues ):
|
||||
if ( $show_leagues ) :
|
||||
$leagues = $official->leagues();
|
||||
if ( $leagues && ! is_wp_error( $leagues ) ):
|
||||
if ( $leagues && ! is_wp_error( $leagues ) ) :
|
||||
$terms = array();
|
||||
foreach ( $leagues as $league ) {
|
||||
$terms[] = $league->name;
|
||||
@@ -107,9 +116,9 @@ if ( $show_leagues ):
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $show_seasons ):
|
||||
if ( $show_seasons ) :
|
||||
$seasons = $official->seasons();
|
||||
if ( $seasons && ! is_wp_error( $seasons ) ):
|
||||
if ( $seasons && ! is_wp_error( $seasons ) ) :
|
||||
$terms = array();
|
||||
foreach ( $seasons as $season ) {
|
||||
$terms[] = $season->name;
|
||||
@@ -120,12 +129,13 @@ endif;
|
||||
|
||||
$data = apply_filters( 'sportspress_official_details', $data, $id );
|
||||
|
||||
if ( empty( $data ) )
|
||||
if ( empty( $data ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$output = '<div class="sp-template sp-template-official-details sp-template-details"><div class="sp-list-wrapper"><dl class="sp-official-details">';
|
||||
|
||||
foreach( $data as $label => $value ):
|
||||
foreach ( $data as $label => $value ) :
|
||||
|
||||
$output .= '<dt>' . $label . '</dt><dd>' . $value . '</dd>';
|
||||
|
||||
|
||||
@@ -2,28 +2,33 @@
|
||||
/**
|
||||
* Player Details
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.7.9
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( get_option( 'sportspress_player_show_details', 'yes' ) === 'no' ) return;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
if ( get_option( 'sportspress_player_show_details', 'yes' ) === 'no' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$defaults = array(
|
||||
'show_number' => get_option( 'sportspress_player_show_number', 'no' ) == 'yes' ? true : false,
|
||||
'show_name' => get_option( 'sportspress_player_show_name', 'no' ) == 'yes' ? true : false,
|
||||
'show_nationality' => get_option( 'sportspress_player_show_nationality', 'yes' ) == 'yes' ? true : false,
|
||||
'show_positions' => get_option( 'sportspress_player_show_positions', 'yes' ) == 'yes' ? true : false,
|
||||
'show_current_teams' => get_option( 'sportspress_player_show_current_teams', 'yes' ) == 'yes' ? true : false,
|
||||
'show_past_teams' => get_option( 'sportspress_player_show_past_teams', 'yes' ) == 'yes' ? true : false,
|
||||
'show_leagues' => get_option( 'sportspress_player_show_leagues', 'no' ) == 'yes' ? true : false,
|
||||
'show_seasons' => get_option( 'sportspress_player_show_seasons', 'no' ) == 'yes' ? true : false,
|
||||
'show_number' => get_option( 'sportspress_player_show_number', 'no' ) == 'yes' ? true : false,
|
||||
'show_name' => get_option( 'sportspress_player_show_name', 'no' ) == 'yes' ? true : false,
|
||||
'show_nationality' => get_option( 'sportspress_player_show_nationality', 'yes' ) == 'yes' ? true : false,
|
||||
'show_positions' => get_option( 'sportspress_player_show_positions', 'yes' ) == 'yes' ? true : false,
|
||||
'show_current_teams' => get_option( 'sportspress_player_show_current_teams', 'yes' ) == 'yes' ? true : false,
|
||||
'show_past_teams' => get_option( 'sportspress_player_show_past_teams', 'yes' ) == 'yes' ? true : false,
|
||||
'show_leagues' => get_option( 'sportspress_player_show_leagues', 'no' ) == 'yes' ? true : false,
|
||||
'show_seasons' => get_option( 'sportspress_player_show_seasons', 'no' ) == 'yes' ? true : false,
|
||||
'show_nationality_flags' => get_option( 'sportspress_player_show_flags', 'yes' ) == 'yes' ? true : false,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
);
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
@@ -33,35 +38,35 @@ $countries = SP()->countries->countries;
|
||||
$player = new SP_Player( $id );
|
||||
|
||||
$metrics_before = $player->metrics( true );
|
||||
$metrics_after = $player->metrics( false );
|
||||
$metrics_after = $player->metrics( false );
|
||||
|
||||
$common = array();
|
||||
|
||||
if ( $show_number ):
|
||||
$common[ '#' ] = $player->number;
|
||||
if ( $show_number ) :
|
||||
$common['#'] = $player->number;
|
||||
endif;
|
||||
|
||||
if ( $show_name ):
|
||||
if ( $show_name ) :
|
||||
$common[ __( 'Name', 'sportspress' ) ] = $player->post->post_title;
|
||||
endif;
|
||||
|
||||
if ( $show_nationality ):
|
||||
if ( $show_nationality ) :
|
||||
$nationalities = $player->nationalities();
|
||||
if ( $nationalities && is_array( $nationalities ) ):
|
||||
if ( $nationalities && is_array( $nationalities ) ) :
|
||||
$values = array();
|
||||
foreach ( $nationalities as $nationality ):
|
||||
foreach ( $nationalities as $nationality ) :
|
||||
$country_name = sp_array_value( $countries, $nationality, null );
|
||||
$values[] = $country_name ? ( $show_nationality_flags ? sp_flags( $nationality ) : '' ) . $country_name : '—';
|
||||
$values[] = $country_name ? ( $show_nationality_flags ? sp_flags( $nationality ) : '' ) . $country_name : '—';
|
||||
endforeach;
|
||||
$common[ __( 'Nationality', 'sportspress' ) ] = implode( '<br>', $values );
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $show_positions ):
|
||||
if ( $show_positions ) :
|
||||
$positions = $player->positions();
|
||||
if ( $positions && is_array( $positions ) ):
|
||||
if ( $positions && is_array( $positions ) ) :
|
||||
$position_names = array();
|
||||
foreach ( $positions as $position ):
|
||||
foreach ( $positions as $position ) :
|
||||
$position_names[] = $position->name;
|
||||
endforeach;
|
||||
$common[ __( 'Position', 'sportspress' ) ] = implode( ', ', $position_names );
|
||||
@@ -70,35 +75,39 @@ endif;
|
||||
|
||||
$data = array_merge( $metrics_before, $common, $metrics_after );
|
||||
|
||||
if ( $show_current_teams ):
|
||||
if ( $show_current_teams ) :
|
||||
$current_teams = array_filter( $player->current_teams() );
|
||||
if ( $current_teams ):
|
||||
if ( $current_teams ) :
|
||||
$teams = array();
|
||||
foreach ( $current_teams as $team ):
|
||||
foreach ( $current_teams as $team ) :
|
||||
$team_name = sp_team_short_name( $team );
|
||||
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
if ( $link_teams ) {
|
||||
$team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
}
|
||||
$teams[] = $team_name;
|
||||
endforeach;
|
||||
$data[ __( 'Current Team', 'sportspress' ) ] = implode( ', ', $teams );
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $show_past_teams ):
|
||||
if ( $show_past_teams ) :
|
||||
$past_teams = array_filter( $player->past_teams() );
|
||||
if ( $past_teams ):
|
||||
if ( $past_teams ) :
|
||||
$teams = array();
|
||||
foreach ( $past_teams as $team ):
|
||||
foreach ( $past_teams as $team ) :
|
||||
$team_name = sp_team_short_name( $team );
|
||||
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
if ( $link_teams ) {
|
||||
$team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
}
|
||||
$teams[] = $team_name;
|
||||
endforeach;
|
||||
$data[ __( 'Past Teams', 'sportspress' ) ] = implode( ', ', $teams );
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $show_leagues ):
|
||||
if ( $show_leagues ) :
|
||||
$leagues = $player->leagues();
|
||||
if ( $leagues && ! is_wp_error( $leagues ) ):
|
||||
if ( $leagues && ! is_wp_error( $leagues ) ) :
|
||||
$terms = array();
|
||||
foreach ( $leagues as $league ) {
|
||||
$terms[] = $league->name;
|
||||
@@ -107,9 +116,9 @@ if ( $show_leagues ):
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $show_seasons ):
|
||||
if ( $show_seasons ) :
|
||||
$seasons = $player->seasons();
|
||||
if ( $seasons && ! is_wp_error( $seasons ) ):
|
||||
if ( $seasons && ! is_wp_error( $seasons ) ) :
|
||||
$terms = array();
|
||||
foreach ( $seasons as $season ) {
|
||||
$terms[] = $season->name;
|
||||
@@ -120,12 +129,13 @@ endif;
|
||||
|
||||
$data = apply_filters( 'sportspress_player_details', $data, $id );
|
||||
|
||||
if ( empty( $data ) )
|
||||
if ( empty( $data ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$output = '<div class="sp-template sp-template-player-details sp-template-details"><div class="sp-list-wrapper"><dl class="sp-player-details">';
|
||||
|
||||
foreach( $data as $label => $value ):
|
||||
foreach ( $data as $label => $value ) :
|
||||
|
||||
$output .= '<dt>' . $label . '</dt><dd>' . $value . '</dd>';
|
||||
|
||||
|
||||
@@ -2,29 +2,32 @@
|
||||
/**
|
||||
* Player Events
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.2
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$format = get_option( 'sportspress_player_events_format', 'blocks' );
|
||||
if ( 'calendar' === $format )
|
||||
if ( 'calendar' === $format ) {
|
||||
sp_get_template( 'event-calendar.php', array( 'player' => $id ) );
|
||||
elseif ( 'list' === $format ) {
|
||||
} elseif ( 'list' === $format ) {
|
||||
$args = array(
|
||||
'player' => $id,
|
||||
'player' => $id,
|
||||
'title_format' => 'homeaway',
|
||||
'time_format' => 'separate',
|
||||
'columns' => array( 'event', 'time', 'results' ),
|
||||
'order' => 'DESC',
|
||||
'time_format' => 'separate',
|
||||
'columns' => array( 'event', 'time', 'results' ),
|
||||
'order' => 'DESC',
|
||||
);
|
||||
$args = apply_filters( 'sp_player_events_list_args', $args );
|
||||
sp_get_template( 'event-list.php', $args );
|
||||
}
|
||||
else
|
||||
} else {
|
||||
sp_get_template( 'event-fixtures-results.php', array( 'player' => $id ) );
|
||||
}
|
||||
|
||||
@@ -2,19 +2,21 @@
|
||||
/**
|
||||
* Player Gallery Thumbnail
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.2
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
$defaults = array(
|
||||
'id' => null,
|
||||
'icontag' => 'dt',
|
||||
'id' => null,
|
||||
'icontag' => 'dt',
|
||||
'captiontag' => 'dd',
|
||||
'caption' => null,
|
||||
'size' => 'sportspress-crop-medium',
|
||||
'caption' => null,
|
||||
'size' => 'sportspress-crop-medium',
|
||||
'link_posts' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
|
||||
);
|
||||
|
||||
@@ -22,20 +24,24 @@ extract( $defaults, EXTR_SKIP );
|
||||
|
||||
// Add player number to caption if available
|
||||
$player_number = get_post_meta( $id, 'sp_number', true );
|
||||
if ( '' !== $player_number )
|
||||
if ( '' !== $player_number ) {
|
||||
$caption = '<strong>' . $player_number . '</strong> ' . $caption;
|
||||
}
|
||||
|
||||
// Add caption tag if has caption
|
||||
if ( $captiontag && $caption )
|
||||
if ( $captiontag && $caption ) {
|
||||
$caption = '<' . $captiontag . ' class="wp-caption-text gallery-caption small-3 columns' . ( '' !== $player_number ? ' has-number' : '' ) . '">' . wptexturize( $caption ) . '</' . $captiontag . '>';
|
||||
}
|
||||
|
||||
if ( $link_posts )
|
||||
if ( $link_posts ) {
|
||||
$caption = '<a href="' . get_permalink( $id ) . '">' . $caption . '</a>';
|
||||
}
|
||||
|
||||
if ( has_post_thumbnail( $id ) )
|
||||
if ( has_post_thumbnail( $id ) ) {
|
||||
$thumbnail = get_the_post_thumbnail( $id, $size );
|
||||
else
|
||||
} else {
|
||||
$thumbnail = '<img width="150" height="150" src="//www.gravatar.com/avatar/?s=150&d=mm&f=y" class="attachment-thumbnail wp-post-image">';
|
||||
}
|
||||
|
||||
echo "<{$itemtag} class='gallery-item'>";
|
||||
echo "
|
||||
|
||||
@@ -2,54 +2,61 @@
|
||||
/**
|
||||
* Player Gallery
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.5
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
$html5 = current_theme_supports( 'html5', 'gallery' );
|
||||
$html5 = current_theme_supports( 'html5', 'gallery' );
|
||||
$defaults = array(
|
||||
'id' => get_the_ID(),
|
||||
'title' => false,
|
||||
'number' => -1,
|
||||
'grouping' => null,
|
||||
'orderby' => 'default',
|
||||
'order' => 'ASC',
|
||||
'itemtag' => 'dl',
|
||||
'icontag' => 'dt',
|
||||
'captiontag' => 'dd',
|
||||
'grouptag' => 'h4',
|
||||
'columns' => 3,
|
||||
'size' => 'sportspress-crop-medium',
|
||||
'id' => get_the_ID(),
|
||||
'title' => false,
|
||||
'number' => -1,
|
||||
'grouping' => null,
|
||||
'orderby' => 'default',
|
||||
'order' => 'ASC',
|
||||
'itemtag' => 'dl',
|
||||
'icontag' => 'dt',
|
||||
'captiontag' => 'dd',
|
||||
'grouptag' => 'h4',
|
||||
'columns' => 3,
|
||||
'size' => 'sportspress-crop-medium',
|
||||
'show_all_players_link' => false,
|
||||
'link_posts' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
|
||||
'link_posts' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
|
||||
);
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
|
||||
// Determine number of players to display
|
||||
if ( -1 === $number ):
|
||||
if ( -1 === $number ) :
|
||||
$number = (int) get_post_meta( $id, 'sp_number', true );
|
||||
if ( $number <= 0 ) $number = -1;
|
||||
if ( $number <= 0 ) {
|
||||
$number = -1;
|
||||
}
|
||||
endif;
|
||||
|
||||
$itemtag = tag_escape( $itemtag );
|
||||
$itemtag = tag_escape( $itemtag );
|
||||
$captiontag = tag_escape( $captiontag );
|
||||
$icontag = tag_escape( $icontag );
|
||||
$icontag = tag_escape( $icontag );
|
||||
$valid_tags = wp_kses_allowed_html( 'post' );
|
||||
if ( ! isset( $valid_tags[ $itemtag ] ) )
|
||||
if ( ! isset( $valid_tags[ $itemtag ] ) ) {
|
||||
$itemtag = 'dl';
|
||||
if ( ! isset( $valid_tags[ $captiontag ] ) )
|
||||
}
|
||||
if ( ! isset( $valid_tags[ $captiontag ] ) ) {
|
||||
$captiontag = 'dd';
|
||||
if ( ! isset( $valid_tags[ $icontag ] ) )
|
||||
}
|
||||
if ( ! isset( $valid_tags[ $icontag ] ) ) {
|
||||
$icontag = 'dt';
|
||||
}
|
||||
|
||||
$columns = intval( $columns );
|
||||
$itemwidth = $columns > 0 ? floor(100/$columns) : 100;
|
||||
$size = $size;
|
||||
$float = is_rtl() ? 'right' : 'left';
|
||||
$columns = intval( $columns );
|
||||
$itemwidth = $columns > 0 ? floor( 100 / $columns ) : 100;
|
||||
$size = $size;
|
||||
$float = is_rtl() ? 'right' : 'left';
|
||||
|
||||
$selector = 'sp-player-gallery-' . $id;
|
||||
|
||||
@@ -59,30 +66,31 @@ $data = $list->data();
|
||||
// Remove the first row to leave us with the actual data
|
||||
unset( $data[0] );
|
||||
|
||||
if ( $grouping === null || $grouping === 'default' ):
|
||||
if ( $grouping === null || $grouping === 'default' ) :
|
||||
$grouping = $list->grouping;
|
||||
endif;
|
||||
|
||||
if ( $orderby == 'default' ):
|
||||
if ( $orderby == 'default' ) :
|
||||
$orderby = $list->orderby;
|
||||
$order = $list->order;
|
||||
elseif ( $orderby == 'rand' ):
|
||||
$order = $list->order;
|
||||
elseif ( $orderby == 'rand' ) :
|
||||
uasort( $data, 'sp_sort_random' );
|
||||
else:
|
||||
else :
|
||||
$list->priorities = array(
|
||||
array(
|
||||
'key' => $orderby,
|
||||
'key' => $orderby,
|
||||
'order' => $order,
|
||||
),
|
||||
);
|
||||
uasort( $data, array( $list, 'sort' ) );
|
||||
endif;
|
||||
|
||||
if ( $title )
|
||||
if ( $title ) {
|
||||
echo '<h4 class="sp-table-caption">' . $title . '</h4>';
|
||||
}
|
||||
|
||||
$gallery_style = $gallery_div = '';
|
||||
if ( apply_filters( 'use_default_gallery_style', ! $html5 ) )
|
||||
if ( apply_filters( 'use_default_gallery_style', ! $html5 ) ) {
|
||||
$gallery_style = "
|
||||
<style type='text/css'>
|
||||
#{$selector} {
|
||||
@@ -102,89 +110,103 @@ if ( apply_filters( 'use_default_gallery_style', ! $html5 ) )
|
||||
}
|
||||
/* see gallery_shortcode() in wp-includes/media.php */
|
||||
</style>";
|
||||
$size_class = sanitize_html_class( $size );
|
||||
}
|
||||
$size_class = sanitize_html_class( $size );
|
||||
$gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
|
||||
echo apply_filters( 'gallery_style', $gallery_style . "\n\t\t" );
|
||||
?>
|
||||
<?php echo $gallery_div; ?>
|
||||
<?php
|
||||
if ( intval( $number ) > 0 )
|
||||
if ( intval( $number ) > 0 ) {
|
||||
$limit = $number;
|
||||
}
|
||||
|
||||
if ( $grouping === 'position' ):
|
||||
$groups = get_terms( 'sp_position', array(
|
||||
'orderby' => 'meta_value_num',
|
||||
'meta_query' => array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => 'sp_order',
|
||||
'compare' => 'NOT EXISTS'
|
||||
if ( $grouping === 'position' ) :
|
||||
$groups = get_terms(
|
||||
'sp_position',
|
||||
array(
|
||||
'orderby' => 'meta_value_num',
|
||||
'meta_query' => array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => 'sp_order',
|
||||
'compare' => 'NOT EXISTS',
|
||||
),
|
||||
array(
|
||||
'key' => 'sp_order',
|
||||
'compare' => 'EXISTS',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'key' => 'sp_order',
|
||||
'compare' => 'EXISTS'
|
||||
),
|
||||
),
|
||||
) );
|
||||
else:
|
||||
$group = new stdClass();
|
||||
)
|
||||
);
|
||||
else :
|
||||
$group = new stdClass();
|
||||
$group->term_id = null;
|
||||
$group->name = null;
|
||||
$group->slug = null;
|
||||
$groups = array( $group );
|
||||
$group->name = null;
|
||||
$group->slug = null;
|
||||
$groups = array( $group );
|
||||
endif;
|
||||
|
||||
$j = 0;
|
||||
|
||||
foreach ( $groups as $group ):
|
||||
foreach ( $groups as $group ) :
|
||||
$i = 0;
|
||||
|
||||
$gallery = '';
|
||||
|
||||
if ( ! empty( $group->name ) ):
|
||||
if ( ! empty( $group->name ) ) :
|
||||
$gallery .= '<a name="group-' . $group->slug . '" id="group-' . $group->slug . '"></a>';
|
||||
$gallery .= '<' . $grouptag . ' class="sp-gallery-group-name player-group-name player-gallery-group-name">' . $group->name . '</' . $grouptag . '>';
|
||||
endif;
|
||||
|
||||
foreach( $data as $player_id => $performance ): if ( empty( $group->term_id ) || has_term( $group->term_id, 'sp_position', $player_id ) ):
|
||||
foreach ( $data as $player_id => $performance ) :
|
||||
if ( empty( $group->term_id ) || has_term( $group->term_id, 'sp_position', $player_id ) ) :
|
||||
|
||||
if ( isset( $limit ) && $i >= $limit ) continue;
|
||||
if ( isset( $limit ) && $i >= $limit ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$caption = get_the_title( $player_id );
|
||||
$caption = trim( $caption );
|
||||
$caption = get_the_title( $player_id );
|
||||
$caption = trim( $caption );
|
||||
|
||||
ob_start();
|
||||
ob_start();
|
||||
|
||||
sp_get_template( 'player-gallery-thumbnail.php', array(
|
||||
'id' => $player_id,
|
||||
'itemtag' => $itemtag,
|
||||
'icontag' => $icontag,
|
||||
'captiontag' => $captiontag,
|
||||
'caption' => $caption,
|
||||
'size' => $size,
|
||||
'link_posts' => $link_posts,
|
||||
) );
|
||||
sp_get_template(
|
||||
'player-gallery-thumbnail.php',
|
||||
array(
|
||||
'id' => $player_id,
|
||||
'itemtag' => $itemtag,
|
||||
'icontag' => $icontag,
|
||||
'captiontag' => $captiontag,
|
||||
'caption' => $caption,
|
||||
'size' => $size,
|
||||
'link_posts' => $link_posts,
|
||||
)
|
||||
);
|
||||
|
||||
$gallery .= ob_get_clean();
|
||||
$gallery .= ob_get_clean();
|
||||
|
||||
$i++;
|
||||
$i++;
|
||||
|
||||
endif; endforeach;
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
$j++;
|
||||
|
||||
if ( $i === 0 ) continue;
|
||||
|
||||
if ( $i === 0 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
echo '<div class="sp-template sp-template-player-gallery sp-template-gallery">';
|
||||
|
||||
|
||||
echo '<div class="sp-player-gallery-wrapper sp-gallery-wrapper">';
|
||||
|
||||
|
||||
echo $gallery;
|
||||
|
||||
if ( ! $html5 && $columns > 0 && ++$i % $columns == 0 ) {
|
||||
echo '<br style="clear: both" />';
|
||||
}
|
||||
|
||||
|
||||
echo '</div>';
|
||||
|
||||
if ( $show_all_players_link && ( 'position' !== $grouping || $j == count( $groups ) ) ) {
|
||||
@@ -198,6 +220,6 @@ echo apply_filters( 'gallery_style', $gallery_style . "\n\t\t" );
|
||||
if ( ! $html5 && $columns > 0 && ++$i % $columns == 0 ) {
|
||||
echo '<br style="clear: both" />';
|
||||
}
|
||||
|
||||
echo "</div>\n";
|
||||
?>
|
||||
|
||||
echo "</div>\n";
|
||||
|
||||
|
||||
@@ -2,85 +2,91 @@
|
||||
/**
|
||||
* Player List
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.7.9
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
$defaults = array(
|
||||
'id' => get_the_ID(),
|
||||
'title' => false,
|
||||
'number' => -1,
|
||||
'grouptag' => 'h4',
|
||||
'columns' => null,
|
||||
'grouping' => null,
|
||||
'orderby' => 'default',
|
||||
'order' => 'ASC',
|
||||
'id' => get_the_ID(),
|
||||
'title' => false,
|
||||
'number' => -1,
|
||||
'grouptag' => 'h4',
|
||||
'columns' => null,
|
||||
'grouping' => null,
|
||||
'orderby' => 'default',
|
||||
'order' => 'ASC',
|
||||
'show_all_players_link' => false,
|
||||
'show_title' => get_option( 'sportspress_list_show_title', 'yes' ) == 'yes' ? true : false,
|
||||
'show_player_photo' => get_option( 'sportspress_list_show_photos', 'no' ) == 'yes' ? true : false,
|
||||
'show_player_flag' => get_option( 'sportspress_list_show_flags', 'no' ) == 'yes' ? true : false,
|
||||
'team_format' => get_option( 'sportspress_list_team_format', 'name' ),
|
||||
'link_posts' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
'responsive' => get_option( 'sportspress_enable_responsive_tables', 'no' ) == 'yes' ? true : false,
|
||||
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
'paginated' => get_option( 'sportspress_list_paginated', 'yes' ) == 'yes' ? true : false,
|
||||
'rows' => get_option( 'sportspress_list_rows', 10 ),
|
||||
'leagues' => null,
|
||||
'seasons' => null,
|
||||
'team' => null,
|
||||
'show_title' => get_option( 'sportspress_list_show_title', 'yes' ) == 'yes' ? true : false,
|
||||
'show_player_photo' => get_option( 'sportspress_list_show_photos', 'no' ) == 'yes' ? true : false,
|
||||
'show_player_flag' => get_option( 'sportspress_list_show_flags', 'no' ) == 'yes' ? true : false,
|
||||
'team_format' => get_option( 'sportspress_list_team_format', 'name' ),
|
||||
'link_posts' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
'responsive' => get_option( 'sportspress_enable_responsive_tables', 'no' ) == 'yes' ? true : false,
|
||||
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
'paginated' => get_option( 'sportspress_list_paginated', 'yes' ) == 'yes' ? true : false,
|
||||
'rows' => get_option( 'sportspress_list_rows', 10 ),
|
||||
'leagues' => null,
|
||||
'seasons' => null,
|
||||
'team' => null,
|
||||
);
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
|
||||
// Backward compatibility
|
||||
if ( isset( $performance ) )
|
||||
if ( isset( $performance ) ) {
|
||||
$columns = $performance;
|
||||
}
|
||||
|
||||
// Determine number of players to display
|
||||
if ( -1 === $number ):
|
||||
if ( -1 === $number ) :
|
||||
$number = (int) get_post_meta( $id, 'sp_number', true );
|
||||
if ( $number <= 0 ) $number = -1;
|
||||
if ( $number <= 0 ) {
|
||||
$number = -1;
|
||||
}
|
||||
endif;
|
||||
|
||||
// Explode into array
|
||||
if ( null !== $columns && ! is_array( $columns ) )
|
||||
if ( null !== $columns && ! is_array( $columns ) ) {
|
||||
$columns = explode( ',', $columns );
|
||||
}
|
||||
|
||||
$list = new SP_Player_List( $id );
|
||||
if ( isset( $columns ) && null !== $columns ):
|
||||
if ( isset( $columns ) && null !== $columns ) :
|
||||
$list->columns = $columns;
|
||||
endif;
|
||||
|
||||
$data = apply_filters('sportspress_player_list_data', $list->data( false, $leagues, $seasons, $team ) , $id );
|
||||
$data = apply_filters( 'sportspress_player_list_data', $list->data( false, $leagues, $seasons, $team ), $id );
|
||||
|
||||
// The first row should be labels
|
||||
$labels = $data[0];
|
||||
|
||||
//Create a unique identifier based on the current time in microseconds
|
||||
// Create a unique identifier based on the current time in microseconds
|
||||
$identifier = uniqid( 'playerlist_' );
|
||||
// If responsive tables are enabled then load the inline css code
|
||||
if ( true == $responsive ){
|
||||
//sportspress_responsive_tables_css( $identifier );
|
||||
if ( true == $responsive ) {
|
||||
// sportspress_responsive_tables_css( $identifier );
|
||||
}
|
||||
// Remove the first row and 'head' row to leave us with the actual data
|
||||
unset( $data[0] );
|
||||
|
||||
if ( $grouping === null || $grouping === 'default' ):
|
||||
if ( $grouping === null || $grouping === 'default' ) :
|
||||
$grouping = $list->grouping;
|
||||
endif;
|
||||
|
||||
if ( $orderby == 'default' ):
|
||||
if ( $orderby == 'default' ) :
|
||||
$orderby = $list->orderby;
|
||||
$order = $list->order;
|
||||
else:
|
||||
$order = $list->order;
|
||||
else :
|
||||
$list->priorities = array(
|
||||
array(
|
||||
'key' => $orderby,
|
||||
'key' => $orderby,
|
||||
'order' => $order,
|
||||
),
|
||||
);
|
||||
@@ -89,174 +95,191 @@ endif;
|
||||
|
||||
$output = '';
|
||||
|
||||
if ( $grouping === 'position' ):
|
||||
$groups = get_terms( 'sp_position', array(
|
||||
'orderby' => 'meta_value_num',
|
||||
'meta_query' => array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => 'sp_order',
|
||||
'compare' => 'NOT EXISTS'
|
||||
if ( $grouping === 'position' ) :
|
||||
$groups = get_terms(
|
||||
'sp_position',
|
||||
array(
|
||||
'orderby' => 'meta_value_num',
|
||||
'meta_query' => array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'key' => 'sp_order',
|
||||
'compare' => 'NOT EXISTS',
|
||||
),
|
||||
array(
|
||||
'key' => 'sp_order',
|
||||
'compare' => 'EXISTS',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'key' => 'sp_order',
|
||||
'compare' => 'EXISTS'
|
||||
),
|
||||
),
|
||||
) );
|
||||
else:
|
||||
if ( $show_title && false === $title && $id ):
|
||||
)
|
||||
);
|
||||
else :
|
||||
if ( $show_title && false === $title && $id ) :
|
||||
$caption = $list->caption;
|
||||
if ( $caption )
|
||||
if ( $caption ) {
|
||||
$title = $caption;
|
||||
else
|
||||
} else {
|
||||
$title = get_the_title( $id );
|
||||
}
|
||||
endif;
|
||||
if ( $title )
|
||||
if ( $title ) {
|
||||
$output .= '<' . $grouptag . ' class="sp-table-caption">' . $title . '</' . $grouptag . '>';
|
||||
$group = new stdClass();
|
||||
}
|
||||
$group = new stdClass();
|
||||
$group->term_id = null;
|
||||
$group->name = null;
|
||||
$group->slug = null;
|
||||
$groups = array( $group );
|
||||
$group->name = null;
|
||||
$group->slug = null;
|
||||
$groups = array( $group );
|
||||
endif;
|
||||
|
||||
foreach ( $groups as $group ):
|
||||
foreach ( $groups as $group ) :
|
||||
$i = 0;
|
||||
|
||||
if ( intval( $number ) > 0 )
|
||||
if ( intval( $number ) > 0 ) {
|
||||
$limit = $number;
|
||||
|
||||
}
|
||||
|
||||
$thead = '<thead>' . '<tr>';
|
||||
|
||||
if ( ! is_array( $labels ) || array_key_exists( 'number', $labels ) ):
|
||||
if ( in_array( $orderby, array( 'number', 'name' ) ) ):
|
||||
|
||||
if ( ! is_array( $labels ) || array_key_exists( 'number', $labels ) ) :
|
||||
if ( in_array( $orderby, array( 'number', 'name' ) ) ) :
|
||||
$thead .= '<th class="data-number">#</th>';
|
||||
else:
|
||||
else :
|
||||
$thead .= '<th class="data-rank">' . __( 'Rank', 'sportspress' ) . '</th>';
|
||||
endif;
|
||||
endif;
|
||||
|
||||
foreach( $labels as $key => $label ):
|
||||
if ( $key !== 'number' && ( ! is_array( $columns ) || $key == 'name' || in_array( $key, $columns ) ) )
|
||||
$thead .= '<th class="data-' . $key . '">'. $label . '</th>';
|
||||
foreach ( $labels as $key => $label ) :
|
||||
if ( $key !== 'number' && ( ! is_array( $columns ) || $key == 'name' || in_array( $key, $columns ) ) ) {
|
||||
$thead .= '<th class="data-' . $key . '">' . $label . '</th>';
|
||||
}
|
||||
endforeach;
|
||||
|
||||
$thead .= '</tr>' . '</thead>';
|
||||
|
||||
|
||||
$tbody = '';
|
||||
|
||||
foreach( $data as $player_id => $row ): if ( empty( $group->term_id ) || has_term( $group->term_id, 'sp_position', $player_id ) ):
|
||||
foreach ( $data as $player_id => $row ) :
|
||||
if ( empty( $group->term_id ) || has_term( $group->term_id, 'sp_position', $player_id ) ) :
|
||||
|
||||
if ( isset( $limit ) && $i >= $limit ) continue;
|
||||
|
||||
$name = sp_array_value( $row, 'name', null );
|
||||
if ( ! $name ) continue;
|
||||
|
||||
$tbody .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
||||
|
||||
// Rank or number
|
||||
if ( ! is_array( $labels ) || array_key_exists( 'number', $labels ) ):
|
||||
if ( isset( $orderby ) && $orderby != 'number' ):
|
||||
$tbody .= '<td class="data-rank" data-label="'.$labels['number'].'">' . ( $i + 1 ) . '</td>';
|
||||
else:
|
||||
$tbody .= '<td class="data-number" data-label="'.$labels['number'].'">' . sp_array_value( $row, 'number', ' ' ) . '</td>';
|
||||
endif;
|
||||
endif;
|
||||
|
||||
$name_class = '';
|
||||
|
||||
if ( $show_player_photo ):
|
||||
if ( has_post_thumbnail( $player_id ) ):
|
||||
$logo = get_the_post_thumbnail( $player_id, 'sportspress-fit-icon' );
|
||||
$name = '<span class="player-photo">' . $logo . '</span>' . $name;
|
||||
$name_class .= ' has-photo';
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $show_player_flag ):
|
||||
$player = new SP_Player( $player_id );
|
||||
$nationalities = $player->nationalities();
|
||||
if ( ! empty( $nationalities ) ):
|
||||
foreach ( $nationalities as $nationality ):
|
||||
$name = '<span class="player-flag">' . sp_flags( $nationality ) . '</span>' . $name;
|
||||
endforeach;
|
||||
$name_class .= ' has-photo';
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $link_posts ):
|
||||
$permalink = get_post_permalink( $player_id );
|
||||
$name = '<a href="' . $permalink . '">' . $name . '</a>';
|
||||
endif;
|
||||
|
||||
$tbody .= '<td class="data-name' . $name_class . '" data-label="'.$labels['name'].'">' . $name . '</td>';
|
||||
|
||||
if ( array_key_exists( 'team', $labels ) ):
|
||||
$team = sp_array_value( $row, 'team', get_post_meta( $id, 'sp_current_team', true ) );
|
||||
$team_name = $team ? sp_team_short_name( $team ) : '-';
|
||||
if ( $team_format == 'logo' && has_post_thumbnail( $team ) ){
|
||||
$logo = get_the_post_thumbnail( $team, 'sportspress-fit-icon', array( 'title' => ''.$team_name.'' ) );
|
||||
$team_name = '<span class="team-logo">' . $logo . '</span>';
|
||||
}
|
||||
if ( $link_teams && false !== get_post_status( $team ) ):
|
||||
$team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
endif;
|
||||
$tbody .= '<td class="data-team" data-label="'.$labels['team'].'">' . $team_name . '</td>';
|
||||
endif;
|
||||
|
||||
if ( array_key_exists( 'position', $labels ) ):
|
||||
$position = sp_array_value( $row, 'position', null );
|
||||
if ( null === $position || ! $position ):
|
||||
$positions = wp_strip_all_tags( get_the_term_list( $player_id, 'sp_position', '', ', ' ) );
|
||||
else:
|
||||
$position_term = get_term_by( 'id', $position, 'sp_position', ARRAY_A );
|
||||
$positions = sp_array_value( $position_term, 'name', '—' );
|
||||
endif;
|
||||
$tbody .= '<td class="data-position" data-label="'.$labels['position'].'">' . $positions . '</td>';
|
||||
endif;
|
||||
|
||||
foreach( $labels as $key => $value ):
|
||||
if ( in_array( $key, array( 'number', 'name', 'team', 'position' ) ) )
|
||||
if ( isset( $limit ) && $i >= $limit ) {
|
||||
continue;
|
||||
if ( ! is_array( $columns ) || in_array( $key, $columns ) ) {
|
||||
$label = $labels[$key];
|
||||
if ( preg_match ( "/title=\"(.*?)\"/", $value, $new_label ) ) {
|
||||
$label = $new_label[1];
|
||||
}
|
||||
$tbody .= '<td class="data-' . $key . '" data-label="'.$label.'">' . sp_array_value( $row, $key, '—' ) . '</td>';
|
||||
}
|
||||
endforeach;
|
||||
|
||||
$tbody .= '</tr>';
|
||||
$name = sp_array_value( $row, 'name', null );
|
||||
if ( ! $name ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$i++;
|
||||
$tbody .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
||||
|
||||
endif; endforeach;
|
||||
|
||||
if ( $i === 0 ) continue;
|
||||
// Rank or number
|
||||
if ( ! is_array( $labels ) || array_key_exists( 'number', $labels ) ) :
|
||||
if ( isset( $orderby ) && $orderby != 'number' ) :
|
||||
$tbody .= '<td class="data-rank" data-label="' . $labels['number'] . '">' . ( $i + 1 ) . '</td>';
|
||||
else :
|
||||
$tbody .= '<td class="data-number" data-label="' . $labels['number'] . '">' . sp_array_value( $row, 'number', ' ' ) . '</td>';
|
||||
endif;
|
||||
endif;
|
||||
|
||||
$name_class = '';
|
||||
|
||||
if ( $show_player_photo ) :
|
||||
if ( has_post_thumbnail( $player_id ) ) :
|
||||
$logo = get_the_post_thumbnail( $player_id, 'sportspress-fit-icon' );
|
||||
$name = '<span class="player-photo">' . $logo . '</span>' . $name;
|
||||
$name_class .= ' has-photo';
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $show_player_flag ) :
|
||||
$player = new SP_Player( $player_id );
|
||||
$nationalities = $player->nationalities();
|
||||
if ( ! empty( $nationalities ) ) :
|
||||
foreach ( $nationalities as $nationality ) :
|
||||
$name = '<span class="player-flag">' . sp_flags( $nationality ) . '</span>' . $name;
|
||||
endforeach;
|
||||
$name_class .= ' has-photo';
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $link_posts ) :
|
||||
$permalink = get_post_permalink( $player_id );
|
||||
$name = '<a href="' . $permalink . '">' . $name . '</a>';
|
||||
endif;
|
||||
|
||||
$tbody .= '<td class="data-name' . $name_class . '" data-label="' . $labels['name'] . '">' . $name . '</td>';
|
||||
|
||||
if ( array_key_exists( 'team', $labels ) ) :
|
||||
$team = sp_array_value( $row, 'team', get_post_meta( $id, 'sp_current_team', true ) );
|
||||
$team_name = $team ? sp_team_short_name( $team ) : '-';
|
||||
if ( $team_format == 'logo' && has_post_thumbnail( $team ) ) {
|
||||
$logo = get_the_post_thumbnail( $team, 'sportspress-fit-icon', array( 'title' => '' . $team_name . '' ) );
|
||||
$team_name = '<span class="team-logo">' . $logo . '</span>';
|
||||
}
|
||||
if ( $link_teams && false !== get_post_status( $team ) ) :
|
||||
$team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
endif;
|
||||
$tbody .= '<td class="data-team" data-label="' . $labels['team'] . '">' . $team_name . '</td>';
|
||||
endif;
|
||||
|
||||
if ( array_key_exists( 'position', $labels ) ) :
|
||||
$position = sp_array_value( $row, 'position', null );
|
||||
if ( null === $position || ! $position ) :
|
||||
$positions = wp_strip_all_tags( get_the_term_list( $player_id, 'sp_position', '', ', ' ) );
|
||||
else :
|
||||
$position_term = get_term_by( 'id', $position, 'sp_position', ARRAY_A );
|
||||
$positions = sp_array_value( $position_term, 'name', '—' );
|
||||
endif;
|
||||
$tbody .= '<td class="data-position" data-label="' . $labels['position'] . '">' . $positions . '</td>';
|
||||
endif;
|
||||
|
||||
foreach ( $labels as $key => $value ) :
|
||||
if ( in_array( $key, array( 'number', 'name', 'team', 'position' ) ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( ! is_array( $columns ) || in_array( $key, $columns ) ) {
|
||||
$label = $labels[ $key ];
|
||||
if ( preg_match( '/title="(.*?)"/', $value, $new_label ) ) {
|
||||
$label = $new_label[1];
|
||||
}
|
||||
$tbody .= '<td class="data-' . $key . '" data-label="' . $label . '">' . sp_array_value( $row, $key, '—' ) . '</td>';
|
||||
}
|
||||
endforeach;
|
||||
|
||||
$tbody .= '</tr>';
|
||||
|
||||
$i++;
|
||||
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
if ( $i === 0 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$output .= '<div class="sp-template sp-template-player-list">';
|
||||
|
||||
if ( ! empty( $group->name ) ):
|
||||
if ( ! empty( $group->name ) ) :
|
||||
$output .= '<a name="group-' . $group->slug . '" id="group-' . $group->slug . '"></a>';
|
||||
$output .= '<' . $grouptag . ' class="sp-table-caption player-group-name player-list-group-name">' . $group->name . '</' . $grouptag . '>';
|
||||
endif;
|
||||
|
||||
$output .= '<div class="sp-table-wrapper">' .
|
||||
'<table class="sp-player-list sp-data-table' . ( $sortable ? ' sp-sortable-table' : '' ). ( $responsive ? ' sp-responsive-table '.$identifier : '' ) . ( $scrollable ? ' sp-scrollable-table' : '' ) . ( $paginated ? ' sp-paginated-table' : '' ) . '" data-sp-rows="' . $rows . '">';
|
||||
|
||||
'<table class="sp-player-list sp-data-table' . ( $sortable ? ' sp-sortable-table' : '' ) . ( $responsive ? ' sp-responsive-table ' . $identifier : '' ) . ( $scrollable ? ' sp-scrollable-table' : '' ) . ( $paginated ? ' sp-paginated-table' : '' ) . '" data-sp-rows="' . $rows . '">';
|
||||
|
||||
$output .= $thead . '<tbody>';
|
||||
|
||||
|
||||
$output .= $tbody;
|
||||
|
||||
$output .= '</tbody>' . '</table>' . '</div>';
|
||||
|
||||
if ( $show_all_players_link ):
|
||||
if ( $show_all_players_link ) :
|
||||
$output .= '<div class="sp-player-list-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View all players', 'sportspress' ) . '</a></div>';
|
||||
endif;
|
||||
|
||||
$output .= '</div>';
|
||||
endforeach;
|
||||
?>
|
||||
<?php echo $output; ?>
|
||||
<?php
|
||||
echo $output;
|
||||
|
||||
@@ -2,21 +2,26 @@
|
||||
/**
|
||||
* Player Photo
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 1.4
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( get_option( 'sportspress_player_show_photo', 'yes' ) === 'no' ) return;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
if ( get_option( 'sportspress_player_show_photo', 'yes' ) === 'no' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
if ( has_post_thumbnail( $id ) ):
|
||||
if ( has_post_thumbnail( $id ) ) :
|
||||
?>
|
||||
<div class="sp-template sp-template-player-photo sp-template-photo sp-player-photo">
|
||||
<?php echo get_the_post_thumbnail( $id, 'sportspress-fit-medium' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
endif;
|
||||
|
||||
@@ -2,54 +2,59 @@
|
||||
/**
|
||||
* Player Dropdown
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.6.8
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( get_option( 'sportspress_player_show_selector', 'yes' ) === 'no' ) return;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
if ( get_option( 'sportspress_player_show_selector', 'yes' ) === 'no' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$league_ids = sp_get_the_term_ids( $id, 'sp_league' );
|
||||
$season_ids = sp_get_the_term_ids( $id, 'sp_season' );
|
||||
$team = get_post_meta( $id, 'sp_current_team', true );
|
||||
$team = get_post_meta( $id, 'sp_current_team', true );
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'sp_player',
|
||||
'numberposts' => 500,
|
||||
'post_type' => 'sp_player',
|
||||
'numberposts' => 500,
|
||||
'posts_per_page' => 500,
|
||||
'meta_key' => 'sp_number',
|
||||
'orderby' => 'meta_value_num',
|
||||
'order' => 'ASC',
|
||||
'tax_query' => array(
|
||||
'meta_key' => 'sp_number',
|
||||
'orderby' => 'meta_value_num',
|
||||
'order' => 'ASC',
|
||||
'tax_query' => array(
|
||||
'relation' => 'AND',
|
||||
),
|
||||
);
|
||||
|
||||
if ( $league_ids ):
|
||||
if ( $league_ids ) :
|
||||
$args['tax_query'][] = array(
|
||||
'taxonomy' => 'sp_league',
|
||||
'field' => 'term_id',
|
||||
'terms' => $league_ids
|
||||
'field' => 'term_id',
|
||||
'terms' => $league_ids,
|
||||
);
|
||||
endif;
|
||||
|
||||
if ( $season_ids ):
|
||||
if ( $season_ids ) :
|
||||
$args['tax_query'][] = array(
|
||||
'taxonomy' => 'sp_season',
|
||||
'field' => 'term_id',
|
||||
'terms' => $season_ids
|
||||
'field' => 'term_id',
|
||||
'terms' => $season_ids,
|
||||
);
|
||||
endif;
|
||||
|
||||
if ( $team ):
|
||||
if ( $team ) :
|
||||
$args['meta_query'] = array(
|
||||
array(
|
||||
'key' => 'sp_current_team',
|
||||
'value' => $team
|
||||
'key' => 'sp_current_team',
|
||||
'value' => $team,
|
||||
),
|
||||
);
|
||||
endif;
|
||||
@@ -60,18 +65,18 @@ $players = get_posts( $args );
|
||||
|
||||
$options = array();
|
||||
|
||||
if ( $players && is_array( $players ) ):
|
||||
foreach ( $players as $player ):
|
||||
$name = $player->post_title;
|
||||
if ( $players && is_array( $players ) ) :
|
||||
foreach ( $players as $player ) :
|
||||
$name = $player->post_title;
|
||||
$number = get_post_meta( $player->ID, 'sp_number', true );
|
||||
if ( isset( $number ) && '' !== $number ):
|
||||
if ( isset( $number ) && '' !== $number ) :
|
||||
$name = $number . '. ' . $name;
|
||||
endif;
|
||||
$options[] = '<option value="' . get_post_permalink( $player->ID ) . '" ' . selected( $player->ID, $id, false ) . '>' . $name . '</option>';
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
if ( sizeof( $options ) > 1 ):
|
||||
if ( sizeof( $options ) > 1 ) :
|
||||
?>
|
||||
<div class="sp-template sp-template-player-selector sp-template-profile-selector">
|
||||
<select class="sp-profile-selector sp-player-selector sp-selector-redirect">
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* Player Statistics for Single League
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @category Admin
|
||||
* @package SportsPress/Admin/Meta_Boxes
|
||||
* @author ThemeBoy
|
||||
* @category Admin
|
||||
* @package SportsPress/Admin/Meta_Boxes
|
||||
* @version 2.5
|
||||
*/
|
||||
|
||||
@@ -15,16 +15,18 @@ $labels = $data[0];
|
||||
unset( $data[0] );
|
||||
|
||||
// Skip if there are no rows in the table
|
||||
if ( empty( $data ) )
|
||||
if ( empty( $data ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$output = '<h4 class="sp-table-caption">' . $caption . '</h4>' .
|
||||
'<div class="sp-table-wrapper">' .
|
||||
'<table class="sp-player-statistics sp-data-table' . ( $scrollable ? ' sp-scrollable-table' : '' ) . '">' . '<thead>' . '<tr>';
|
||||
|
||||
foreach( $labels as $key => $label ):
|
||||
if ( isset( $hide_teams ) && 'team' == $key )
|
||||
foreach ( $labels as $key => $label ) :
|
||||
if ( isset( $hide_teams ) && 'team' == $key ) {
|
||||
continue;
|
||||
}
|
||||
$output .= '<th class="data-' . $key . '">' . $label . '</th>';
|
||||
endforeach;
|
||||
|
||||
@@ -32,13 +34,14 @@ $output .= '</tr>' . '</thead>' . '<tbody>';
|
||||
|
||||
$i = 0;
|
||||
|
||||
foreach( $data as $season_id => $row ):
|
||||
foreach ( $data as $season_id => $row ) :
|
||||
|
||||
$output .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
||||
|
||||
foreach( $labels as $key => $value ):
|
||||
if ( isset( $hide_teams ) && 'team' == $key )
|
||||
foreach ( $labels as $key => $value ) :
|
||||
if ( isset( $hide_teams ) && 'team' == $key ) {
|
||||
continue;
|
||||
}
|
||||
$output .= '<td class="data-' . $key . ( -1 === $season_id ? ' sp-highlight' : '' ) . '">' . sp_array_value( $row, $key, '' ) . '</td>';
|
||||
endforeach;
|
||||
|
||||
|
||||
@@ -2,37 +2,42 @@
|
||||
/**
|
||||
* Player Statistics
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.6.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( 'no' === get_option( 'sportspress_player_show_statistics', 'yes' ) && 'no' === get_option( 'sportspress_player_show_total', 'no' ) ) return;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
if ( 'no' === get_option( 'sportspress_player_show_statistics', 'yes' ) && 'no' === get_option( 'sportspress_player_show_total', 'no' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$player = new SP_Player( $id );
|
||||
|
||||
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
||||
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
||||
$show_career_totals = 'yes' === get_option( 'sportspress_player_show_career_total', 'no' ) ? true : false;
|
||||
$sections = get_option( 'sportspress_player_performance_sections', -1 );
|
||||
$show_teams = apply_filters( 'sportspress_player_team_statistics', true );
|
||||
$leagues = array_filter( ( array ) get_the_terms( $id, 'sp_league' ) );
|
||||
$sections = get_option( 'sportspress_player_performance_sections', -1 );
|
||||
$show_teams = apply_filters( 'sportspress_player_team_statistics', true );
|
||||
$leagues = array_filter( (array) get_the_terms( $id, 'sp_league' ) );
|
||||
|
||||
// Sort Leagues by User Defined Order (PHP5.2 supported)
|
||||
foreach ( $leagues as $key => $league ) {
|
||||
$leagues[ $key ]->sp_order = get_term_meta ( $league->term_id , 'sp_order', true );
|
||||
$leagues[ $key ]->sp_order = get_term_meta( $league->term_id, 'sp_order', true );
|
||||
}
|
||||
if ( ! function_exists( 'sortByOrder' ) ) {
|
||||
function sortByOrder($a, $b) {
|
||||
if ( ! function_exists( 'sortByOrder' ) ) {
|
||||
function sortByOrder( $a, $b ) {
|
||||
return (int) $a->sp_order - (int) $b->sp_order;
|
||||
}
|
||||
}
|
||||
usort($leagues, 'sortByOrder');
|
||||
usort( $leagues, 'sortByOrder' );
|
||||
|
||||
$positions = $player->positions();
|
||||
$positions = $player->positions();
|
||||
$player_sections = array();
|
||||
if ( $positions ) {
|
||||
foreach ( $positions as $position ) {
|
||||
@@ -42,7 +47,10 @@ if ( $positions ) {
|
||||
|
||||
// Determine order of sections
|
||||
if ( 1 == $sections ) {
|
||||
$section_order = array( 1 => __( 'Defense', 'sportspress' ), 0 => __( 'Offense', 'sportspress' ) );
|
||||
$section_order = array(
|
||||
1 => __( 'Defense', 'sportspress' ),
|
||||
0 => __( 'Offense', 'sportspress' ),
|
||||
);
|
||||
} elseif ( 0 == $sections ) {
|
||||
$section_order = array( __( 'Offense', 'sportspress' ), __( 'Defense', 'sportspress' ) );
|
||||
} else {
|
||||
@@ -50,17 +58,19 @@ if ( 1 == $sections ) {
|
||||
}
|
||||
|
||||
// Loop through statistics for each league
|
||||
if ( is_array( $leagues ) ):
|
||||
if ( is_array( $leagues ) ) :
|
||||
foreach ( $section_order as $section_id => $section_label ) {
|
||||
if ( -1 !== $section_id && ! empty( $player_sections ) && ! in_array( $section_id, $player_sections ) ) continue;
|
||||
|
||||
if ( -1 !== $section_id && ! empty( $player_sections ) && ! in_array( $section_id, $player_sections ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( sizeof( $leagues ) > 1 ) {
|
||||
printf( '<h3 class="sp-post-caption sp-player-statistics-section">%s</h3>', $section_label );
|
||||
}
|
||||
|
||||
foreach ( $leagues as $league ):
|
||||
|
||||
foreach ( $leagues as $league ) :
|
||||
$caption = $league->name;
|
||||
|
||||
|
||||
if ( null !== $section_label ) {
|
||||
if ( sizeof( $leagues ) === 1 ) {
|
||||
$caption = $section_label;
|
||||
@@ -68,10 +78,10 @@ if ( is_array( $leagues ) ):
|
||||
}
|
||||
|
||||
$args = array(
|
||||
'data' => $player->data( $league->term_id, false, $section_id ),
|
||||
'caption' => $caption,
|
||||
'data' => $player->data( $league->term_id, false, $section_id ),
|
||||
'caption' => $caption,
|
||||
'scrollable' => $scrollable,
|
||||
'league_id' => $league->term_id,
|
||||
'league_id' => $league->term_id,
|
||||
);
|
||||
if ( ! $show_teams ) {
|
||||
$args['hide_teams'] = true;
|
||||
@@ -80,12 +90,15 @@ if ( is_array( $leagues ) ):
|
||||
endforeach;
|
||||
|
||||
if ( $show_career_totals ) {
|
||||
sp_get_template( 'player-statistics-league.php', array(
|
||||
'data' => $player->data( 0, false, $section_id ),
|
||||
'caption' => __( 'Career Total', 'sportspress' ),
|
||||
'scrollable' => $scrollable,
|
||||
'hide_teams' => true,
|
||||
) );
|
||||
sp_get_template(
|
||||
'player-statistics-league.php',
|
||||
array(
|
||||
'data' => $player->data( 0, false, $section_id ),
|
||||
'caption' => __( 'Career Total', 'sportspress' ),
|
||||
'scrollable' => $scrollable,
|
||||
'hide_teams' => true,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
@@ -2,20 +2,23 @@
|
||||
/**
|
||||
* Post Excerpt
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.6.9
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$post = get_post( $id );
|
||||
$post = get_post( $id );
|
||||
$excerpt = $post->post_excerpt;
|
||||
if ( $excerpt ) {
|
||||
?>
|
||||
<p class="sp-excerpt"><?php echo $excerpt; ?></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,23 +2,28 @@
|
||||
/**
|
||||
* Staff Content
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.5.5
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( get_option( 'sportspress_staff_show_content', 'yes' ) === 'no' ) return;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
if ( get_option( 'sportspress_staff_show_content', 'yes' ) === 'no' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
$id = get_the_ID();
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$post = get_post( $id );
|
||||
$post = get_post( $id );
|
||||
$content = $post->post_content;
|
||||
if ( $content ) {
|
||||
?>
|
||||
<div class="sp-post-content">
|
||||
<?php echo apply_filters( 'the_content', $content ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="sp-post-content">
|
||||
<?php echo apply_filters( 'the_content', $content ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -2,23 +2,28 @@
|
||||
/**
|
||||
* Staff Details
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.7.9
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( get_option( 'sportspress_staff_show_details', 'yes' ) === 'no' ) return;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
if ( get_option( 'sportspress_staff_show_details', 'yes' ) === 'no' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$defaults = array(
|
||||
'show_nationality' => get_option( 'sportspress_staff_show_nationality', 'yes' ) == 'yes' ? true : false,
|
||||
'show_current_teams' => get_option( 'sportspress_staff_show_current_teams', 'yes' ) == 'yes' ? true : false,
|
||||
'show_past_teams' => get_option( 'sportspress_staff_show_past_teams', 'yes' ) == 'yes' ? true : false,
|
||||
'show_nationality' => get_option( 'sportspress_staff_show_nationality', 'yes' ) == 'yes' ? true : false,
|
||||
'show_current_teams' => get_option( 'sportspress_staff_show_current_teams', 'yes' ) == 'yes' ? true : false,
|
||||
'show_past_teams' => get_option( 'sportspress_staff_show_past_teams', 'yes' ) == 'yes' ? true : false,
|
||||
'show_nationality_flags' => get_option( 'sportspress_staff_show_flags', 'yes' ) == 'yes' ? true : false,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
);
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
@@ -29,38 +34,42 @@ $staff = new SP_Staff( $id );
|
||||
|
||||
$nationalities = $staff->nationalities();
|
||||
$current_teams = $staff->current_teams();
|
||||
$past_teams = $staff->past_teams();
|
||||
$past_teams = $staff->past_teams();
|
||||
|
||||
$data = array();
|
||||
if ( $show_nationality && $nationalities && is_array( $nationalities ) ):
|
||||
if ( $show_nationality && $nationalities && is_array( $nationalities ) ) :
|
||||
$values = array();
|
||||
foreach ( $nationalities as $nationality ):
|
||||
if ( 2 == strlen( $nationality ) ):
|
||||
$legacy = SP()->countries->legacy;
|
||||
foreach ( $nationalities as $nationality ) :
|
||||
if ( 2 == strlen( $nationality ) ) :
|
||||
$legacy = SP()->countries->legacy;
|
||||
$nationality = strtolower( $nationality );
|
||||
$nationality = sp_array_value( $legacy, $nationality, null );
|
||||
endif;
|
||||
$country_name = sp_array_value( $countries, $nationality, null );
|
||||
$values[] = $country_name ? ( $show_nationality_flags ? sp_flags( $nationality ) : '' ) . $country_name : '—';
|
||||
$values[] = $country_name ? ( $show_nationality_flags ? sp_flags( $nationality ) : '' ) . $country_name : '—';
|
||||
endforeach;
|
||||
$data[ __( 'Nationality', 'sportspress' ) ] = implode( '<br>', $values );
|
||||
endif;
|
||||
|
||||
if ( $show_current_teams && $current_teams ):
|
||||
if ( $show_current_teams && $current_teams ) :
|
||||
$teams = array();
|
||||
foreach ( $current_teams as $team ):
|
||||
foreach ( $current_teams as $team ) :
|
||||
$team_name = sp_team_short_name( $team );
|
||||
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
if ( $link_teams ) {
|
||||
$team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
}
|
||||
$teams[] = $team_name;
|
||||
endforeach;
|
||||
$data[ __( 'Current Team', 'sportspress' ) ] = implode( ', ', $teams );
|
||||
endif;
|
||||
|
||||
if ( $show_past_teams && $past_teams ):
|
||||
if ( $show_past_teams && $past_teams ) :
|
||||
$teams = array();
|
||||
foreach ( $past_teams as $team ):
|
||||
foreach ( $past_teams as $team ) :
|
||||
$team_name = sp_team_short_name( $team );
|
||||
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
if ( $link_teams ) {
|
||||
$team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
}
|
||||
$teams[] = $team_name;
|
||||
endforeach;
|
||||
$data[ __( 'Past Teams', 'sportspress' ) ] = implode( ', ', $teams );
|
||||
@@ -68,13 +77,14 @@ endif;
|
||||
|
||||
$data = apply_filters( 'sportspress_staff_details', $data, $id );
|
||||
|
||||
if ( empty( $data ) )
|
||||
if ( empty( $data ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$output = '<div class="sp-list-wrapper">' .
|
||||
'<dl class="sp-staff-details">';
|
||||
|
||||
foreach( $data as $label => $value ):
|
||||
foreach ( $data as $label => $value ) :
|
||||
|
||||
$output .= '<dt>' . $label . '</dt><dd>' . $value . '</dd>';
|
||||
|
||||
@@ -84,4 +94,4 @@ $output .= '</dl></div>';
|
||||
?>
|
||||
<div class="sp-template sp-template-staff-details sp-template-details">
|
||||
<?php echo $output; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,23 +2,28 @@
|
||||
/**
|
||||
* Staff Excerpt
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.5.5
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( get_option( 'sportspress_staff_show_excerpt', 'yes' ) === 'no' ) return;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
if ( get_option( 'sportspress_staff_show_excerpt', 'yes' ) === 'no' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
$id = get_the_ID();
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$post = get_post( $id );
|
||||
$post = get_post( $id );
|
||||
$excerpt = $post->post_excerpt;
|
||||
if ( $excerpt ) {
|
||||
?>
|
||||
<p class="sp-excerpt">
|
||||
<?php echo $excerpt; ?>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<p class="sp-excerpt">
|
||||
<?php echo $excerpt; ?>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -2,24 +2,28 @@
|
||||
/**
|
||||
* Staff Header
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.6
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
$id = get_the_ID();
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$post = function_exists( 'icl_object_id' ) ? get_post( icl_object_id( $id, 'sp_staff', true ) ) : get_post( $id );
|
||||
$post = function_exists( 'icl_object_id' ) ? get_post( icl_object_id( $id, 'sp_staff', true ) ) : get_post( $id );
|
||||
$title = $post->post_title;
|
||||
if ( $title ) {
|
||||
$staff = new SP_Staff( $id );
|
||||
$role = $staff->role();
|
||||
if ( $role )
|
||||
$title = '<strong class="sp-staff-role">' . $role->name . '</strong> ' . $title;
|
||||
?>
|
||||
<h3 class="sp-staff-name"><?php echo $title ?></h3>
|
||||
<?php
|
||||
$staff = new SP_Staff( $id );
|
||||
$role = $staff->role();
|
||||
if ( $role ) {
|
||||
$title = '<strong class="sp-staff-role">' . $role->name . '</strong> ' . $title;
|
||||
}
|
||||
?>
|
||||
<h3 class="sp-staff-name"><?php echo $title; ?></h3>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -2,21 +2,26 @@
|
||||
/**
|
||||
* Staff Photo
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 1.4
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( get_option( 'sportspress_staff_show_photo', 'yes' ) === 'no' ) return;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
if ( get_option( 'sportspress_staff_show_photo', 'yes' ) === 'no' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
if ( has_post_thumbnail( $id ) ):
|
||||
if ( has_post_thumbnail( $id ) ) :
|
||||
?>
|
||||
<div class="sp-template sp-template-staff-photo sp-template-photo sp-staff-photo">
|
||||
<?php echo get_the_post_thumbnail( $id, 'sportspress-fit-medium' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
endif;
|
||||
|
||||
@@ -2,53 +2,58 @@
|
||||
/**
|
||||
* Staff Dropdown
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.3
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( get_option( 'sportspress_staff_show_selector', 'yes' ) === 'no' ) return;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
if ( get_option( 'sportspress_staff_show_selector', 'yes' ) === 'no' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$league_ids = sp_get_the_term_ids( $id, 'sp_league' );
|
||||
$season_ids = sp_get_the_term_ids( $id, 'sp_season' );
|
||||
$team = get_post_meta( $id, 'sp_current_team', true );
|
||||
$team = get_post_meta( $id, 'sp_current_team', true );
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'sp_staff',
|
||||
'numberposts' => 500,
|
||||
'post_type' => 'sp_staff',
|
||||
'numberposts' => 500,
|
||||
'posts_per_page' => 500,
|
||||
'orderby' => 'title',
|
||||
'order' => 'ASC',
|
||||
'tax_query' => array(
|
||||
'orderby' => 'title',
|
||||
'order' => 'ASC',
|
||||
'tax_query' => array(
|
||||
'relation' => 'AND',
|
||||
),
|
||||
);
|
||||
|
||||
if ( $league_ids ):
|
||||
if ( $league_ids ) :
|
||||
$args['tax_query'][] = array(
|
||||
'taxonomy' => 'sp_league',
|
||||
'field' => 'term_id',
|
||||
'terms' => $league_ids
|
||||
'field' => 'term_id',
|
||||
'terms' => $league_ids,
|
||||
);
|
||||
endif;
|
||||
|
||||
if ( $season_ids ):
|
||||
if ( $season_ids ) :
|
||||
$args['tax_query'][] = array(
|
||||
'taxonomy' => 'sp_season',
|
||||
'field' => 'term_id',
|
||||
'terms' => $season_ids
|
||||
'field' => 'term_id',
|
||||
'terms' => $season_ids,
|
||||
);
|
||||
endif;
|
||||
|
||||
if ( $team ):
|
||||
if ( $team ) :
|
||||
$args['meta_query'] = array(
|
||||
array(
|
||||
'key' => 'sp_team',
|
||||
'value' => $team
|
||||
'key' => 'sp_team',
|
||||
'value' => $team,
|
||||
),
|
||||
);
|
||||
endif;
|
||||
@@ -57,13 +62,13 @@ $staffs = get_posts( $args );
|
||||
|
||||
$options = array();
|
||||
|
||||
if ( $staffs && is_array( $staffs ) ):
|
||||
foreach ( $staffs as $staff ):
|
||||
if ( $staffs && is_array( $staffs ) ) :
|
||||
foreach ( $staffs as $staff ) :
|
||||
$options[] = '<option value="' . get_post_permalink( $staff->ID ) . '" ' . selected( $staff->ID, $id, false ) . '>' . $staff->post_title . '</option>';
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
if ( sizeof( $options ) > 1 ):
|
||||
if ( sizeof( $options ) > 1 ) :
|
||||
?>
|
||||
<div class="sp-template sp-template-staff-selector sp-template-profile-selector">
|
||||
<select class="sp-profile-selector sp-staff-selector sp-selector-redirect">
|
||||
@@ -71,4 +76,4 @@ if ( sizeof( $options ) > 1 ):
|
||||
</select>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
endif;
|
||||
|
||||
@@ -2,44 +2,49 @@
|
||||
/**
|
||||
* Team Details
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.7.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( get_option( 'sportspress_team_show_details', 'no' ) === 'no' ) return;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
if ( get_option( 'sportspress_team_show_details', 'no' ) === 'no' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$data = array();
|
||||
|
||||
$terms = get_the_terms( $id, 'sp_league' );
|
||||
if ( $terms ):
|
||||
if ( $terms ) :
|
||||
$leagues = array();
|
||||
foreach ( $terms as $term ):
|
||||
foreach ( $terms as $term ) :
|
||||
$leagues[] = $term->name;
|
||||
endforeach;
|
||||
$data[ __( 'Leagues', 'sportspress' ) ] = implode( ', ', $leagues );
|
||||
endif;
|
||||
|
||||
$terms = get_the_terms( $id, 'sp_season' );
|
||||
if ( $terms ):
|
||||
if ( $terms ) :
|
||||
$seasons = array();
|
||||
foreach ( $terms as $term ):
|
||||
foreach ( $terms as $term ) :
|
||||
$seasons[] = $term->name;
|
||||
endforeach;
|
||||
$data[ __( 'Seasons', 'sportspress' ) ] = implode( ', ', $seasons );
|
||||
endif;
|
||||
|
||||
$terms = get_the_terms( $id, 'sp_venue' );
|
||||
if ( $terms ):
|
||||
if ( get_option( 'sportspress_team_link_venues', 'no' ) === 'yes' ):
|
||||
if ( $terms ) :
|
||||
if ( get_option( 'sportspress_team_link_venues', 'no' ) === 'yes' ) :
|
||||
$data[ __( 'Home', 'sportspress' ) ] = get_the_term_list( $id, 'sp_venue', '', ', ' );
|
||||
else:
|
||||
else :
|
||||
$venues = array();
|
||||
foreach ( $terms as $term ):
|
||||
foreach ( $terms as $term ) :
|
||||
$venues[] = $term->name;
|
||||
endforeach;
|
||||
$data[ __( 'Home', 'sportspress' ) ] = implode( ', ', $venues );
|
||||
@@ -49,7 +54,7 @@ endif;
|
||||
$output = '<div class="sp-list-wrapper">' .
|
||||
'<dl class="sp-team-details">';
|
||||
|
||||
foreach( $data as $label => $value ):
|
||||
foreach ( $data as $label => $value ) :
|
||||
|
||||
$output .= '<dt>' . $label . '</dt><dd>' . $value . '</dd>';
|
||||
|
||||
|
||||
@@ -2,29 +2,31 @@
|
||||
/**
|
||||
* Team Events
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.6.9
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$format = get_option( 'sportspress_team_events_format', 'blocks' );
|
||||
if ( 'calendar' === $format ) {
|
||||
sp_get_template( 'event-calendar.php', array( 'team' => $id ) );
|
||||
}
|
||||
elseif ( 'list' === $format ) {
|
||||
} elseif ( 'list' === $format ) {
|
||||
$args = array(
|
||||
'team' => $id,
|
||||
'league' => apply_filters( 'sp_team_events_league', 0 ),
|
||||
'season' => apply_filters( 'sp_team_events_season', 0 ),
|
||||
'team' => $id,
|
||||
'league' => apply_filters( 'sp_team_events_league', 0 ),
|
||||
'season' => apply_filters( 'sp_team_events_season', 0 ),
|
||||
'title_format' => 'homeaway',
|
||||
'time_format' => 'separate',
|
||||
'columns' => array( 'event', 'time', 'results' ),
|
||||
'order' => 'DESC',
|
||||
'time_format' => 'separate',
|
||||
'columns' => array( 'event', 'time', 'results' ),
|
||||
'order' => 'DESC',
|
||||
);
|
||||
$args = apply_filters( 'sp_team_events_list_args', $args );
|
||||
sp_get_template( 'event-list.php', $args );
|
||||
|
||||
@@ -2,35 +2,40 @@
|
||||
/**
|
||||
* Team Gallery Thumbnail
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.4
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
$defaults = array(
|
||||
'id' => null,
|
||||
'icontag' => 'dt',
|
||||
'id' => null,
|
||||
'icontag' => 'dt',
|
||||
'captiontag' => 'dd',
|
||||
'caption' => null,
|
||||
'size' => 'sportspress-crop-medium',
|
||||
'caption' => null,
|
||||
'size' => 'sportspress-crop-medium',
|
||||
'link_posts' => get_option( 'sportspress_link_teams', 'yes' ) == 'yes' ? true : false,
|
||||
);
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
|
||||
// Add caption tag if has caption
|
||||
if ( $captiontag && $caption )
|
||||
if ( $captiontag && $caption ) {
|
||||
$caption = '<' . $captiontag . ' class="wp-caption-text gallery-caption small-3 columns">' . wptexturize( $caption ) . '</' . $captiontag . '>';
|
||||
}
|
||||
|
||||
if ( $link_posts )
|
||||
if ( $link_posts ) {
|
||||
$caption = '<a href="' . get_permalink( $id ) . '">' . $caption . '</a>';
|
||||
}
|
||||
|
||||
if ( has_post_thumbnail( $id ) )
|
||||
if ( has_post_thumbnail( $id ) ) {
|
||||
$thumbnail = get_the_post_thumbnail( $id, $size );
|
||||
else
|
||||
} else {
|
||||
$thumbnail = '<img width="150" height="150" src="//www.gravatar.com/avatar/?s=150&d=blank&f=y" class="attachment-thumbnail wp-post-image">';
|
||||
}
|
||||
|
||||
echo "<{$itemtag} class='gallery-item'>";
|
||||
echo "
|
||||
|
||||
@@ -2,71 +2,79 @@
|
||||
/**
|
||||
* Team Gallery
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.4
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
$html5 = current_theme_supports( 'html5', 'gallery' );
|
||||
$html5 = current_theme_supports( 'html5', 'gallery' );
|
||||
$defaults = array(
|
||||
'id' => get_the_ID(),
|
||||
'title' => false,
|
||||
'number' => -1,
|
||||
'orderby' => 'default',
|
||||
'itemtag' => 'dl',
|
||||
'icontag' => 'dt',
|
||||
'captiontag' => 'dd',
|
||||
'columns' => 3,
|
||||
'size' => 'sportspress-crop-medium',
|
||||
'id' => get_the_ID(),
|
||||
'title' => false,
|
||||
'number' => -1,
|
||||
'orderby' => 'default',
|
||||
'itemtag' => 'dl',
|
||||
'icontag' => 'dt',
|
||||
'captiontag' => 'dd',
|
||||
'columns' => 3,
|
||||
'size' => 'sportspress-crop-medium',
|
||||
'show_all_teams_link' => false,
|
||||
'link_posts' => get_option( 'sportspress_link_teams', 'yes' ) == 'yes' ? true : false,
|
||||
'link_posts' => get_option( 'sportspress_link_teams', 'yes' ) == 'yes' ? true : false,
|
||||
);
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
|
||||
// Determine number of teams to display
|
||||
if ( -1 === $number ):
|
||||
if ( -1 === $number ) :
|
||||
$number = (int) get_post_meta( $id, 'sp_number', true );
|
||||
if ( $number <= 0 ) $number = -1;
|
||||
if ( $number <= 0 ) {
|
||||
$number = -1;
|
||||
}
|
||||
endif;
|
||||
|
||||
$itemtag = tag_escape( $itemtag );
|
||||
$itemtag = tag_escape( $itemtag );
|
||||
$captiontag = tag_escape( $captiontag );
|
||||
$icontag = tag_escape( $icontag );
|
||||
$icontag = tag_escape( $icontag );
|
||||
$valid_tags = wp_kses_allowed_html( 'post' );
|
||||
if ( ! isset( $valid_tags[ $itemtag ] ) )
|
||||
if ( ! isset( $valid_tags[ $itemtag ] ) ) {
|
||||
$itemtag = 'dl';
|
||||
if ( ! isset( $valid_tags[ $captiontag ] ) )
|
||||
}
|
||||
if ( ! isset( $valid_tags[ $captiontag ] ) ) {
|
||||
$captiontag = 'dd';
|
||||
if ( ! isset( $valid_tags[ $icontag ] ) )
|
||||
}
|
||||
if ( ! isset( $valid_tags[ $icontag ] ) ) {
|
||||
$icontag = 'dt';
|
||||
}
|
||||
|
||||
$columns = intval( $columns );
|
||||
$itemwidth = $columns > 0 ? floor(100/$columns) : 100;
|
||||
$size = $size;
|
||||
$float = is_rtl() ? 'right' : 'left';
|
||||
$columns = intval( $columns );
|
||||
$itemwidth = $columns > 0 ? floor( 100 / $columns ) : 100;
|
||||
$size = $size;
|
||||
$float = is_rtl() ? 'right' : 'left';
|
||||
|
||||
$selector = 'sp-team-gallery-' . $id;
|
||||
|
||||
$table = new SP_League_Table( $id );
|
||||
$data = $table->data();
|
||||
$data = $table->data();
|
||||
|
||||
// Remove the first row to leave us with the actual data
|
||||
unset( $data[0] );
|
||||
|
||||
if ( $orderby == 'name' ):
|
||||
if ( $orderby == 'name' ) :
|
||||
uasort( $data, 'sp_sort_by_name' );
|
||||
elseif ( $orderby == 'rand' ):
|
||||
elseif ( $orderby == 'rand' ) :
|
||||
uasort( $data, 'sp_sort_random' );
|
||||
endif;
|
||||
|
||||
if ( $title )
|
||||
if ( $title ) {
|
||||
echo '<h4 class="sp-table-caption">' . $title . '</h4>';
|
||||
}
|
||||
|
||||
$gallery_style = $gallery_div = '';
|
||||
if ( apply_filters( 'use_default_gallery_style', ! $html5 ) )
|
||||
if ( apply_filters( 'use_default_gallery_style', ! $html5 ) ) {
|
||||
$gallery_style = "
|
||||
<style type='text/css'>
|
||||
#{$selector} {
|
||||
@@ -86,37 +94,44 @@ if ( apply_filters( 'use_default_gallery_style', ! $html5 ) )
|
||||
}
|
||||
/* see gallery_shortcode() in wp-includes/media.php */
|
||||
</style>";
|
||||
$size_class = sanitize_html_class( $size );
|
||||
}
|
||||
$size_class = sanitize_html_class( $size );
|
||||
$gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
|
||||
echo apply_filters( 'gallery_style', $gallery_style . "\n\t\t" );
|
||||
?>
|
||||
<?php echo $gallery_div; ?>
|
||||
<?php
|
||||
if ( intval( $number ) > 0 )
|
||||
if ( intval( $number ) > 0 ) {
|
||||
$limit = $number;
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
|
||||
$gallery = '';
|
||||
|
||||
foreach( $data as $team_id => $row ):
|
||||
foreach ( $data as $team_id => $row ) :
|
||||
|
||||
if ( isset( $limit ) && $i >= $limit ) continue;
|
||||
if ( isset( $limit ) && $i >= $limit ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$caption = get_the_title( $team_id );
|
||||
$caption = trim( $caption );
|
||||
|
||||
ob_start();
|
||||
|
||||
sp_get_template( 'team-gallery-thumbnail.php', array(
|
||||
'id' => $team_id,
|
||||
'itemtag' => $itemtag,
|
||||
'icontag' => $icontag,
|
||||
'captiontag' => $captiontag,
|
||||
'caption' => $caption,
|
||||
'size' => $size,
|
||||
'link_posts' => $link_posts,
|
||||
) );
|
||||
sp_get_template(
|
||||
'team-gallery-thumbnail.php',
|
||||
array(
|
||||
'id' => $team_id,
|
||||
'itemtag' => $itemtag,
|
||||
'icontag' => $icontag,
|
||||
'captiontag' => $captiontag,
|
||||
'caption' => $caption,
|
||||
'size' => $size,
|
||||
'link_posts' => $link_posts,
|
||||
)
|
||||
);
|
||||
|
||||
$gallery .= ob_get_clean();
|
||||
|
||||
@@ -125,15 +140,15 @@ echo apply_filters( 'gallery_style', $gallery_style . "\n\t\t" );
|
||||
endforeach;
|
||||
|
||||
echo '<div class="sp-template sp-template-team-gallery sp-template-gallery">';
|
||||
|
||||
|
||||
echo '<div class="sp-team-gallery-wrapper sp-gallery-wrapper">';
|
||||
|
||||
|
||||
echo $gallery;
|
||||
|
||||
if ( ! $html5 && $columns > 0 && ++$i % $columns == 0 ) {
|
||||
echo '<br style="clear: both" />';
|
||||
}
|
||||
|
||||
|
||||
echo '</div>';
|
||||
|
||||
if ( $show_all_teams_link ) {
|
||||
@@ -145,6 +160,6 @@ echo apply_filters( 'gallery_style', $gallery_style . "\n\t\t" );
|
||||
if ( ! $html5 && $columns > 0 && ++$i % $columns == 0 ) {
|
||||
echo '<br style="clear: both" />';
|
||||
}
|
||||
|
||||
echo "</div>\n";
|
||||
?>
|
||||
|
||||
echo "</div>\n";
|
||||
|
||||
|
||||
@@ -2,23 +2,33 @@
|
||||
/**
|
||||
* Team Link
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 1.4
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( get_option( 'sportspress_team_show_link', 'yes' ) === 'no' ) return;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
if ( get_option( 'sportspress_team_show_link', 'yes' ) === 'no' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$url = get_post_meta( $id, 'sp_url', true );
|
||||
|
||||
if ( empty( $url ) )
|
||||
if ( empty( $url ) ) {
|
||||
return false;
|
||||
}
|
||||
?>
|
||||
<form action="<?php echo $url; ?>"<?php if ( get_option( 'sportspress_team_site_target_blank', 'no' ) == 'yes' ) { ?> target="_blank"<?php } ?>>
|
||||
<form action="<?php echo $url; ?>"
|
||||
<?php
|
||||
if ( get_option( 'sportspress_team_site_target_blank', 'no' ) == 'yes' ) {
|
||||
?>
|
||||
target="_blank"<?php } ?>>
|
||||
<input type="submit" class="button sp-button sp-team-button" value="<?php _e( 'Visit Site', 'sportspress' ); ?>">
|
||||
</form>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
@@ -2,32 +2,36 @@
|
||||
/**
|
||||
* Team Player Lists
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 1.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$team = new SP_Team( $id );
|
||||
$team = new SP_Team( $id );
|
||||
$lists = $team->lists();
|
||||
|
||||
foreach ( $lists as $list ):
|
||||
$id = $list->ID;
|
||||
foreach ( $lists as $list ) :
|
||||
$id = $list->ID;
|
||||
$grouping = get_post_meta( $id, 'sp_grouping', true );
|
||||
|
||||
if ( $grouping == 0 && sizeof( $lists ) > 1 ):
|
||||
if ( $grouping == 0 && sizeof( $lists ) > 1 ) :
|
||||
?>
|
||||
<h4 class="sp-table-caption"><?php echo $list->post_title; ?></h4>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
$format = get_post_meta( $id, 'sp_format', true );
|
||||
if ( array_key_exists( $format, SP()->formats->list ) )
|
||||
if ( array_key_exists( $format, SP()->formats->list ) ) {
|
||||
sp_get_template( 'player-' . $format . '.php', array( 'id' => $id ) );
|
||||
else
|
||||
} else {
|
||||
sp_get_template( 'player-list.php', array( 'id' => $id ) );
|
||||
}
|
||||
endforeach;
|
||||
|
||||
@@ -2,21 +2,26 @@
|
||||
/**
|
||||
* Team Logo
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 1.4
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( get_option( 'sportspress_team_show_logo', 'yes' ) === 'no' ) return;
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
if ( get_option( 'sportspress_team_show_logo', 'yes' ) === 'no' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
if ( has_post_thumbnail( $id ) ):
|
||||
if ( has_post_thumbnail( $id ) ) :
|
||||
?>
|
||||
<div class="sp-template sp-template-team-logo sp-template-logo sp-team-logo">
|
||||
<?php echo get_the_post_thumbnail( $id, 'sportspress-fit-icon' ); ?>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
endif;
|
||||
|
||||
@@ -2,33 +2,36 @@
|
||||
/**
|
||||
* Team Staff
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 2.5.5
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$team = new SP_Team( $id );
|
||||
$members = $team->staff();
|
||||
$team = new SP_Team( $id );
|
||||
$members = $team->staff();
|
||||
$link_staff = get_option( 'sportspress_team_link_staff', 'no' ) === 'yes' ? true : false;
|
||||
|
||||
foreach ( $members as $staff ):
|
||||
$id = $staff->ID;
|
||||
foreach ( $members as $staff ) :
|
||||
$id = $staff->ID;
|
||||
$name = $staff->post_title;
|
||||
|
||||
|
||||
$staff = new SP_Staff( $id );
|
||||
$roles = $staff->roles();
|
||||
|
||||
if ( ! empty( $roles ) ):
|
||||
if ( ! empty( $roles ) ) :
|
||||
$roles = wp_list_pluck( $roles, 'name' );
|
||||
$name = '<span class="sp-staff-role">' . implode( '<span class="sp-staff-role-delimiter">/</span>', $roles ) . '</span> ' . $name;
|
||||
$name = '<span class="sp-staff-role">' . implode( '<span class="sp-staff-role-delimiter">/</span>', $roles ) . '</span> ' . $name;
|
||||
endif;
|
||||
?>
|
||||
<h4 class="sp-staff-name"><?php echo $link_staff ? '<a href="'. get_permalink( $id ) .'">'. $name .'</a>' : $name ?></h4>
|
||||
<h4 class="sp-staff-name"><?php echo $link_staff ? '<a href="' . get_permalink( $id ) . '">' . $name . '</a>' : $name; ?></h4>
|
||||
<?php
|
||||
sp_get_template( 'staff-photo.php', array( 'id' => $id ) );
|
||||
sp_get_template( 'staff-details.php', array( 'id' => $id ) );
|
||||
|
||||
@@ -2,21 +2,32 @@
|
||||
/**
|
||||
* Team League Tables
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 1.8.7
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
if ( ! isset( $id ) ) {
|
||||
$id = get_the_ID();
|
||||
}
|
||||
|
||||
$team = new SP_Team( $id );
|
||||
$team = new SP_Team( $id );
|
||||
$tables = $team->tables();
|
||||
|
||||
foreach ( $tables as $table ):
|
||||
if ( ! $table ) continue;
|
||||
foreach ( $tables as $table ) :
|
||||
if ( ! $table ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
sp_get_template( 'league-table.php', array( 'id' => $table->ID, 'highlight' => $id ) );
|
||||
sp_get_template(
|
||||
'league-table.php',
|
||||
array(
|
||||
'id' => $table->ID,
|
||||
'highlight' => $id,
|
||||
)
|
||||
);
|
||||
endforeach;
|
||||
|
||||
@@ -7,27 +7,36 @@
|
||||
* @version 2.7
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
if ( ! isset( $meta ) )
|
||||
return;
|
||||
|
||||
if ( is_tax( 'sp_venue' ) )
|
||||
do_action ( 'sportspress_before_venue_map' );
|
||||
|
||||
$address = sp_array_value( $meta, 'sp_address', null );
|
||||
$address = urlencode( $address );
|
||||
$latitude = sp_array_value( $meta, 'sp_latitude', null );
|
||||
$longitude = sp_array_value( $meta, 'sp_longitude', null );
|
||||
$zoom = get_option( 'sportspress_map_zoom', 15 );
|
||||
$maptype = get_option( 'sportspress_map_type', 'roadmap' );
|
||||
$maptype = strtolower( $maptype );
|
||||
|
||||
if ( '' === $address ) $address = '+';
|
||||
if ( 'satellite' !== $maptype ) $maptype = 'roadmap';
|
||||
|
||||
if ( $latitude != null && $longitude != null ){
|
||||
do_action ( 'sp_venue_show_map', $latitude, $longitude, $address, $zoom, $maptype );
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly
|
||||
}
|
||||
|
||||
if ( ! isset( $meta ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_tax( 'sp_venue' ) ) {
|
||||
do_action( 'sportspress_before_venue_map' );
|
||||
}
|
||||
|
||||
$address = sp_array_value( $meta, 'sp_address', null );
|
||||
$address = urlencode( $address );
|
||||
$latitude = sp_array_value( $meta, 'sp_latitude', null );
|
||||
$longitude = sp_array_value( $meta, 'sp_longitude', null );
|
||||
$zoom = get_option( 'sportspress_map_zoom', 15 );
|
||||
$maptype = get_option( 'sportspress_map_type', 'roadmap' );
|
||||
$maptype = strtolower( $maptype );
|
||||
|
||||
if ( '' === $address ) {
|
||||
$address = '+';
|
||||
}
|
||||
if ( 'satellite' !== $maptype ) {
|
||||
$maptype = 'roadmap';
|
||||
}
|
||||
|
||||
if ( $latitude != null && $longitude != null ) {
|
||||
do_action( 'sp_venue_show_map', $latitude, $longitude, $address, $zoom, $maptype );
|
||||
}
|
||||
if ( is_tax( 'sp_venue' ) ) {
|
||||
do_action( 'sportspress_after_venue_map' );
|
||||
}
|
||||
if ( is_tax( 'sp_venue' ) )
|
||||
do_action ( 'sportspress_after_venue_map' );
|
||||
Reference in New Issue
Block a user