Add div wrappers to templates

This commit is contained in:
Brian Miyaji
2014-08-23 21:53:02 +10:00
parent 091c2a33ff
commit 8a4c8d8039
16 changed files with 491 additions and 451 deletions

View File

@@ -28,43 +28,45 @@ extract( $defaults, EXTR_SKIP );
if ( ! isset( $post ) ) return;
?>
<div id="sp-countdown-wrapper">
<h3 class="event-name"><a href="<?php echo get_permalink( $post->ID ); ?>"><?php echo $post->post_title; ?></a></h3>
<?php
if ( isset( $show_venue ) && $show_venue ):
$venues = get_the_terms( $post->ID, 'sp_venue' );
if ( $venues ):
?>
<h5 class="event-venue"><?php the_terms( $post->ID, 'sp_venue' ); ?></h5>
<?php
endif;
endif;
if ( isset( $show_league ) && $show_league ):
$leagues = get_the_terms( $post->ID, 'sp_league' );
if ( $leagues ):
foreach( $leagues as $league ):
$term = get_term( $league->term_id, 'sp_league' );
<div class="sp-template sp-template-countdown">
<div id="sp-countdown-wrapper">
<h3 class="event-name"><a href="<?php echo get_permalink( $post->ID ); ?>"><?php echo $post->post_title; ?></a></h3>
<?php
if ( isset( $show_venue ) && $show_venue ):
$venues = get_the_terms( $post->ID, 'sp_venue' );
if ( $venues ):
?>
<h5 class="event-league"><?php echo $term->name; ?></h5>
<h5 class="event-venue"><?php the_terms( $post->ID, 'sp_venue' ); ?></h5>
<?php
endforeach;
endif;
endif;
endif;
$now = new DateTime( current_time( 'mysql', 0 ) );
$date = new DateTime( $post->post_date );
$interval = date_diff( $now, $date );
if ( isset( $show_league ) && $show_league ):
$leagues = get_the_terms( $post->ID, 'sp_league' );
if ( $leagues ):
foreach( $leagues as $league ):
$term = get_term( $league->term_id, 'sp_league' );
?>
<h5 class="event-league"><?php echo $term->name; ?></h5>
<?php
endforeach;
endif;
endif;
$days = $interval->invert ? 0 : $interval->days;
$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( '-', '/', $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>
<span><?php echo sprintf( '%02s', $s ); ?> <small><?php _e( 'secs', 'sportspress' ); ?></small></span>
</time></p>
$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;
?>
<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( '-', '/', $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>
<span><?php echo sprintf( '%02s', $s ); ?> <small><?php _e( 'secs', 'sportspress' ); ?></small></span>
</time></p>
</div>
</div>

View File

@@ -37,71 +37,73 @@ $usecolumns = $calendar->columns;
if ( isset( $columns ) )
$usecolumns = $columns;
?>
<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 ?>
<tbody>
<?php
$i = 0;
<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 ?>
<tbody>
<?php
$i = 0;
if ( intval( $number ) > 0 )
$limit = $number;
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;
$results = get_post_meta( $event->ID, 'sp_results', true );
$results = get_post_meta( $event->ID, 'sp_results', true );
$teams = array_unique( get_post_meta( $event->ID, 'sp_team' ) );
$logos = array();
$main_results = array();
$teams = array_unique( get_post_meta( $event->ID, 'sp_team' ) );
$logos = array();
$main_results = array();
$j = 0;
foreach( $teams as $team ):
$j++;
if ( has_post_thumbnail ( $team ) ):
if ( $link_teams ):
$logo = '<a href="' . get_post_permalink( $team ) . '" title="' . get_the_title( $team ) . '">' . get_the_post_thumbnail( $team, 'sportspress-fit-icon', array( 'class' => 'team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) ) ) . '</a>';
else:
$logo = get_the_post_thumbnail( $team, 'sportspress-fit-icon', array( 'class' => 'team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) ) );
$j = 0;
foreach( $teams as $team ):
$j++;
if ( has_post_thumbnail ( $team ) ):
if ( $link_teams ):
$logo = '<a href="' . get_post_permalink( $team ) . '" title="' . get_the_title( $team ) . '">' . get_the_post_thumbnail( $team, 'sportspress-fit-icon', array( 'class' => 'team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) ) ) . '</a>';
else:
$logo = get_the_post_thumbnail( $team, 'sportspress-fit-icon', array( 'class' => 'team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) ) );
endif;
$logos[] = $logo;
endif;
$logos[] = $logo;
endif;
$team_results = sp_array_value( $results, $team, null );
$team_results = sp_array_value( $results, $team, null );
if ( $primary_result ):
$team_result = sp_array_value( $team_results, $primary_result, null );
else:
if ( is_array( $team_results ) ):
end( $team_results );
$team_result = prev( $team_results );
if ( $primary_result ):
$team_result = sp_array_value( $team_results, $primary_result, null );
else:
$team_result = null;
if ( is_array( $team_results ) ):
end( $team_results );
$team_result = prev( $team_results );
else:
$team_result = null;
endif;
endif;
endif;
if ( $team_result != null )
$main_results[] = $team_result;
if ( $team_result != null )
$main_results[] = $team_result;
endforeach;
?>
<tr class="sp-row sp-post<?php echo ( $i % 2 == 0 ? ' alternate' : '' ); ?>">
<td>
<?php echo implode( $logos, ' ' ); ?>
<time class="event-date"><?php echo get_the_time( get_option( 'date_format' ), $event ); ?></time>
<?php if ( $event->post_status == 'future' ): ?>
<h5 class="event-time"><?php echo get_the_time( get_option( 'time_format' ), $event ); ?></h5>
<?php else: ?>
<h5 class="event-results"><?php echo implode( $main_results, ' - ' ); ?></h5>
<?php endif; ?>
<h4 class="event-title"><a href="<?php echo get_post_permalink( $event ); ?>"><?php echo $event->post_title; ?></a></h4>
</td>
</tr>
<?php
$i++;
endforeach;
?>
<tr class="sp-row sp-post<?php echo ( $i % 2 == 0 ? ' alternate' : '' ); ?>">
<td>
<?php echo implode( $logos, ' ' ); ?>
<time class="event-date"><?php echo get_the_time( get_option( 'date_format' ), $event ); ?></time>
<?php if ( $event->post_status == 'future' ): ?>
<h5 class="event-time"><?php echo get_the_time( get_option( 'time_format' ), $event ); ?></h5>
<?php else: ?>
<h5 class="event-results"><?php echo implode( $main_results, ' - ' ); ?></h5>
<?php endif; ?>
<h4 class="event-title"><a href="<?php echo get_post_permalink( $event ); ?>"><?php echo $event->post_title; ?></a></h4>
</td>
</tr>
<?php
$i++;
endforeach;
?>
</tbody>
</table>
</tbody>
</table>
</div>
</div>
<?php
if ( $id && $show_all_events_link )

View File

@@ -209,5 +209,7 @@ $calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>\n\t</div>";
if ( $id && $show_all_events_link )
$calendar_output .= '<a class="sp-calendar-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a>';
echo apply_filters( 'sportspress_event_calendar', $calendar_output );
?>
<div class="sp-template sp-template-event-calendar">
<?php echo $calendar_output; ?>
</div>

View File

@@ -30,22 +30,24 @@ if ( $seasons ):
$data[ __( 'Season', 'sportspress' ) ] = $season->name;
endif;
?>
<h4 class="sp-table-caption"><?php _e( 'Details', 'sportspress' ); ?></h4>
<div class="sp-table-wrapper<?php if ( $scrollable ) { ?> sp-scrollable-table-wrapper<?php } ?>">
<table class="sp-event-details sp-data-table">
<thead>
<tr>
<?php $i = 0; foreach( $data as $label => $value ): ?>
<th><?php echo $label; ?></th>
<?php $i++; endforeach; ?>
</tr>
</thead>
<tbody>
<tr class="odd">
<?php $i = 0; foreach( $data as $value ): ?>
<td><?php echo $value; ?></td>
<?php $i++; endforeach; ?>
</tr>
</tbody>
</table>
<div class="sp-template sp-template-event-details">
<h4 class="sp-table-caption"><?php _e( 'Details', 'sportspress' ); ?></h4>
<div class="sp-table-wrapper<?php if ( $scrollable ) { ?> sp-scrollable-table-wrapper<?php } ?>">
<table class="sp-event-details sp-data-table">
<thead>
<tr>
<?php $i = 0; foreach( $data as $label => $value ): ?>
<th><?php echo $label; ?></th>
<?php $i++; endforeach; ?>
</tr>
</thead>
<tbody>
<tr class="odd">
<?php $i = 0; foreach( $data as $value ): ?>
<td><?php echo $value; ?></td>
<?php $i++; endforeach; ?>
</tr>
</tbody>
</table>
</div>
</div>

View File

@@ -47,146 +47,148 @@ if ( isset( $columns ) ):
$usecolumns = explode( ',', $columns );
endif;
?>
<div class="sp-table-wrapper<?php if ( $scrollable ) { ?> sp-scrollable-table-wrapper<?php } ?>">
<table class="sp-event-list sp-data-table<?php if ( $responsive ) { ?> sp-responsive-table<?php } if ( $paginated ) { ?> sp-paginated-table<?php } ?>" data-sp-rows="<?php echo $rows; ?>">
<thead>
<tr>
<?php
echo '<th class="data-date">' . __( 'Date', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'event', $usecolumns ) )
echo '<th class="data-event">' . __( 'Event', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'teams', $usecolumns ) )
echo '<th class="data-teams">' . __( 'Teams', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'time', $usecolumns ) )
echo '<th class="data-time">' . __( 'Time/Results', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'venue', $usecolumns ) )
echo '<th class="data-venue">' . __( 'Venue', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'article', $usecolumns ) )
echo '<th class="data-article">' . __( 'Article', 'sportspress' ) . '</th>';
?>
</tr>
</thead>
<tbody>
<?php
$i = 0;
if ( is_numeric( $number ) && $number > 0 )
$limit = $number;
foreach ( $data as $event ):
if ( isset( $limit ) && $i >= $limit ) continue;
$teams = get_post_meta( $event->ID, 'sp_team' );
$results = get_post_meta( $event->ID, 'sp_results', true );
$video = get_post_meta( $event->ID, 'sp_video', true );
$main_results = array();
$teams_output = '';
if ( $teams ):
foreach ( $teams as $team ):
$name = get_the_title( $team );
if ( $name ):
$team_results = sp_array_value( $results, $team, null );
if ( $primary_result ):
$team_result = sp_array_value( $team_results, $primary_result, null );
else:
if ( is_array( $team_results ) ):
unset( $team_results['outcome'] );
$team_result = end( $team_results );
else:
$team_result = null;
endif;
endif;
if ( $link_teams ):
$teams_output .= '<a href="' . get_post_permalink( $team ) . '">' . $name . '</a>';
else:
$teams_output .= $name;
endif;
if ( $team_result != null ):
$main_results[] = $team_result;
$teams_output .= ' (' . $team_result . ')';
endif;
$teams_output .= '<br>';
endif;
endforeach;
else:
$teams_output .= '&mdash;';
endif;
echo '<tr class="sp-row sp-post' . ( $i % 2 == 0 ? ' alternate' : '' ) . '">';
echo '<td class="data-date"><a href="' . get_permalink( $event->ID ) . '">' . get_post_time( get_option( 'date_format' ), false, $event, true ) . '</a></td>';
<div class="sp-template sp-template-event-list">
<div class="sp-table-wrapper<?php if ( $scrollable ) { ?> sp-scrollable-table-wrapper<?php } ?>">
<table class="sp-event-list sp-data-table<?php if ( $responsive ) { ?> sp-responsive-table<?php } if ( $paginated ) { ?> sp-paginated-table<?php } ?>" data-sp-rows="<?php echo $rows; ?>">
<thead>
<tr>
<?php
echo '<th class="data-date">' . __( 'Date', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'event', $usecolumns ) )
echo '<td class="data-event">' . $event->post_title . '</td>';
echo '<th class="data-event">' . __( 'Event', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'teams', $usecolumns ) ):
echo '<td class="data-teams">';
echo $teams_output;
if ( $usecolumns == null || in_array( 'teams', $usecolumns ) )
echo '<th class="data-teams">' . __( 'Teams', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'time', $usecolumns ) )
echo '<th class="data-time">' . __( 'Time/Results', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'venue', $usecolumns ) )
echo '<th class="data-venue">' . __( 'Venue', 'sportspress' ) . '</th>';
if ( $usecolumns == null || in_array( 'article', $usecolumns ) )
echo '<th class="data-article">' . __( 'Article', 'sportspress' ) . '</th>';
?>
</tr>
</thead>
<tbody>
<?php
$i = 0;
if ( is_numeric( $number ) && $number > 0 )
$limit = $number;
foreach ( $data as $event ):
if ( isset( $limit ) && $i >= $limit ) continue;
$teams = get_post_meta( $event->ID, 'sp_team' );
$results = get_post_meta( $event->ID, 'sp_results', true );
$video = get_post_meta( $event->ID, 'sp_video', true );
$main_results = array();
$teams_output = '';
if ( $teams ):
foreach ( $teams as $team ):
$name = get_the_title( $team );
if ( $name ):
$team_results = sp_array_value( $results, $team, null );
if ( $primary_result ):
$team_result = sp_array_value( $team_results, $primary_result, null );
else:
if ( is_array( $team_results ) ):
unset( $team_results['outcome'] );
$team_result = end( $team_results );
else:
$team_result = null;
endif;
endif;
if ( $link_teams ):
$teams_output .= '<a href="' . get_post_permalink( $team ) . '">' . $name . '</a>';
else:
$teams_output .= $name;
endif;
if ( $team_result != null ):
$main_results[] = $team_result;
$teams_output .= ' (' . $team_result . ')';
endif;
$teams_output .= '<br>';
endif;
endforeach;
else:
$teams_output .= '&mdash;';
endif;
echo '<tr class="sp-row sp-post' . ( $i % 2 == 0 ? ' alternate' : '' ) . '">';
echo '<td class="data-date"><a href="' . get_permalink( $event->ID ) . '">' . get_post_time( get_option( 'date_format' ), false, $event, true ) . '</a></td>';
if ( $usecolumns == null || in_array( 'event', $usecolumns ) )
echo '<td class="data-event">' . $event->post_title . '</td>';
if ( $usecolumns == null || in_array( 'teams', $usecolumns ) ):
echo '<td class="data-teams">';
echo $teams_output;
echo '</td>';
endif;
if ( $usecolumns == null || in_array( 'time', $usecolumns ) ):
echo '<td class="data-time">';
if ( ! empty( $main_results ) ):
echo implode( ' - ', $main_results );
else:
echo get_post_time( get_option( 'time_format' ), false, $event, true );
endif;
echo '</td>';
endif;
if ( $usecolumns == null || in_array( 'time', $usecolumns ) ):
echo '<td class="data-time">';
if ( ! empty( $main_results ) ):
echo implode( ' - ', $main_results );
else:
echo get_post_time( get_option( 'time_format' ), false, $event, true );
endif;
echo '</td>';
endif;
if ( $usecolumns == null || in_array( 'venue', $usecolumns ) ):
echo '<td class="data-venue">';
if ( $link_venues ):
the_terms( $event->ID, 'sp_venue' );
else:
$venues = get_the_terms( $event->ID, 'sp_venue' );
foreach ( $venues as $venue ):
echo $venue->name;
endforeach;
endif;
echo '</td>';
endif;
if ( $usecolumns == null || in_array( 'article', $usecolumns ) ):
echo '<td class="data-article">
<a href="' . get_permalink( $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>';
if ( $usecolumns == null || in_array( 'venue', $usecolumns ) ):
echo '<td class="data-venue">';
if ( $link_venues ):
the_terms( $event->ID, 'sp_venue' );
else:
$venues = get_the_terms( $event->ID, 'sp_venue' );
foreach ( $venues as $venue ):
echo $venue->name;
endforeach;
endif;
if ( $event->post_content !== null ):
if ( $event->post_status == 'publish' ):
_e( 'Recap', 'sportspress' );
else:
_e( 'Preview', 'sportspress' );
echo '</td>';
endif;
if ( $usecolumns == null || in_array( 'article', $usecolumns ) ):
echo '<td class="data-article">
<a href="' . get_permalink( $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' ):
_e( 'Recap', 'sportspress' );
else:
_e( 'Preview', 'sportspress' );
endif;
endif;
endif;
echo '</a>
</td>';
endif;
echo '</a>
</td>';
endif;
echo '</tr>';
echo '</tr>';
$i++;
endforeach;
?>
</tbody>
</table>
$i++;
endforeach;
?>
</tbody>
</table>
</div>
</div>
<?php
if ( $id && $show_all_events_link )

View File

@@ -59,158 +59,160 @@ if ( is_array( $teams ) ):
$data = sp_array_combine( $players, sp_array_value( $performance, $team_id, array() ) );
?>
<h4 class="sp-table-caption"><?php echo get_the_title( $team_id ); ?></h4>
<?php
if ( get_option( 'sportspress_event_show_staff', 'yes' ) == 'yes' ):
sp_get_template( 'event-staff.php', array( 'id' => $id, 'index' => $index ) );
endif;
?>
<div class="sp-table-wrapper<?php if ( $scrollable ) { ?> sp-scrollable-table-wrapper<?php } ?>">
<table class="sp-event-performance sp-data-table <?php if ( $responsive ) { ?> sp-responsive-table<?php } ?>">
<thead>
<tr>
<?php if ( $has_players ): ?>
<th class="data-number">#</th>
<th class="data-name"><?php _e( 'Player', 'sportspress' ); ?></th>
<?php endif; ?>
<?php if ( $mode == 'values' ): foreach( $labels as $key => $label ): ?>
<th class="data-<?php echo $key; ?>"><?php echo $label; ?></th>
<?php endforeach; else: ?>
<th class="sp-performance-icons">&nbsp;</th>
<?php endif; ?>
</tr>
</thead>
<?php if ( $show_players && $has_players ): ?>
<tbody>
<?php
<div class="sp-template sp-template-event-performance">
<h4 class="sp-table-caption"><?php echo get_the_title( $team_id ); ?></h4>
<?php
if ( get_option( 'sportspress_event_show_staff', 'yes' ) == 'yes' ):
sp_get_template( 'event-staff.php', array( 'id' => $id, 'index' => $index ) );
endif;
?>
<div class="sp-table-wrapper<?php if ( $scrollable ) { ?> sp-scrollable-table-wrapper<?php } ?>">
<table class="sp-event-performance sp-data-table <?php if ( $responsive ) { ?> sp-responsive-table<?php } ?>">
<thead>
<tr>
<?php if ( $has_players ): ?>
<th class="data-number">#</th>
<th class="data-name"><?php _e( 'Player', 'sportspress' ); ?></th>
<?php endif; ?>
<?php if ( $mode == 'values' ): foreach( $labels as $key => $label ): ?>
<th class="data-<?php echo $key; ?>"><?php echo $label; ?></th>
<?php endforeach; else: ?>
<th class="sp-performance-icons">&nbsp;</th>
<?php endif; ?>
</tr>
</thead>
<?php if ( $show_players && $has_players ): ?>
<tbody>
<?php
$lineups = array_filter( $data, array( $event, 'lineup_filter' ) );
$subs = array_filter( $data, array( $event, 'sub_filter' ) );
$lineups = array_filter( $data, array( $event, 'lineup_filter' ) );
$subs = array_filter( $data, array( $event, 'sub_filter' ) );
$lineup_sub_relation = array();
foreach ( $subs as $sub_id => $sub ):
if ( ! $sub_id )
continue;
$lineup_sub_relation[ sp_array_value( $sub, 'sub', 0 ) ] = $sub_id;
endforeach;
$i = 0;
foreach( $data as $player_id => $row ):
if ( ! $player_id )
continue;
$name = get_the_title( $player_id );
if ( ! $name )
continue;
echo '<tr class="' . sp_array_value( $row, 'status', 'lineup' ) . ' ' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
$number = sp_array_value( $row, 'number', '&nbsp;' );
// Player number
echo '<td class="data-number">' . $number . '</td>';
if ( $link_posts ):
$permalink = get_post_permalink( $player_id );
$name = '<a href="' . $permalink . '">' . $name . '</a>';
if ( isset( $row['status'] ) && $row['status'] == 'sub' ):
$name = '(' . $name . ')';
endif;
endif;
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'] ):
$name .= ' <span class="sub-out" title="' . get_the_title( $row[ 'sub' ] ) . '">' . sp_array_value( sp_array_value( $data, $row['sub'], array() ), 'number', null ) . '</span>';
endif;
echo '<td class="data-name">' . $name . '</td>';
if ( $mode == 'icons' ); echo '<td class="sp-performance-icons">';
foreach( $labels as $key => $label ):
if ( $key == 'name' )
$lineup_sub_relation = array();
foreach ( $subs as $sub_id => $sub ):
if ( ! $sub_id )
continue;
$value = '&mdash;';
if ( $key == 'position' ):
if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
$position = get_term_by( 'id', $row[ $key ], 'sp_position' );
if ( $position ) $value = $position->name;
$lineup_sub_relation[ sp_array_value( $sub, 'sub', 0 ) ] = $sub_id;
endforeach;
$i = 0;
foreach( $data as $player_id => $row ):
if ( ! $player_id )
continue;
$name = get_the_title( $player_id );
if ( ! $name )
continue;
echo '<tr class="' . sp_array_value( $row, 'status', 'lineup' ) . ' ' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
$number = sp_array_value( $row, 'number', '&nbsp;' );
// Player number
echo '<td class="data-number">' . $number . '</td>';
if ( $link_posts ):
$permalink = get_post_permalink( $player_id );
$name = '<a href="' . $permalink . '">' . $name . '</a>';
if ( isset( $row['status'] ) && $row['status'] == 'sub' ):
$name = '(' . $name . ')';
endif;
else:
if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
endif;
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'] ):
$name .= ' <span class="sub-out" title="' . get_the_title( $row[ 'sub' ] ) . '">' . sp_array_value( sp_array_value( $data, $row['sub'], array() ), 'number', null ) . '</span>';
endif;
echo '<td class="data-name">' . $name . '</td>';
if ( $mode == 'icons' ); echo '<td class="sp-performance-icons">';
foreach( $labels as $key => $label ):
if ( $key == 'name' )
continue;
$value = '&mdash;';
if ( $key == 'position' ):
if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
$position = get_term_by( 'id', $row[ $key ], 'sp_position' );
if ( $position ) $value = $position->name;
endif;
else:
if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
$value = $row[ $key ];
else:
$value = 0;
endif;
endif;
if ( ! array_key_exists( $key, $totals ) ):
$totals[ $key ] = 0;
endif;
$totals[ $key ] += $value;
if ( $mode == 'values' ):
echo '<td class="data-' . $key . '">' . $value . '</td>';
elseif ( intval( $value ) && $mode == 'icons' ):
$performance_id = sp_array_value( $performance_ids, $key, null );
if ( $performance_id && has_post_thumbnail( $performance_id ) ):
echo str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value );
endif;
endif;
endforeach;
if ( $mode == 'icons' ); echo '</td>';
echo '</tr>';
$i++;
endforeach;
?>
</tbody>
<?php endif; ?>
<?php if ( $status == 'results' && get_option( 'sportspress_event_show_total', 'yes' ) == 'yes' && array_key_exists( 0, $data ) ): ?>
<<?php echo ( $show_players && $has_players ? 'tfoot' : 'tbody' ); ?>>
<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">
<?php
if ( $has_players ):
echo '<td class="data-number">&nbsp;</td>';
echo '<td class="data-name">' . __( 'Total', 'sportspress' ) . '</td>';
endif;
$row = $data[0];
if ( $mode == 'icons' ) echo '<td class="sp-performance-icons">';
foreach( $labels as $key => $label ):
if ( $key == 'name' )
continue;
if ( $key == 'position' ):
$value = '&mdash;';
elseif ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
$value = $row[ $key ];
else:
$value = 0;
$value = sp_array_value( $totals, $key, 0 );
endif;
endif;
if ( ! array_key_exists( $key, $totals ) ):
$totals[ $key ] = 0;
endif;
$totals[ $key ] += $value;
if ( $mode == 'values' ):
echo '<td class="data-' . $key . '">' . $value . '</td>';
elseif ( intval( $value ) && $mode == 'icons' ):
$performance_id = sp_array_value( $performance_ids, $key, null );
if ( $performance_id && has_post_thumbnail( $performance_id ) ):
echo str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value );
if ( $mode == 'values' ):
echo '<td class="data-' . $key . '">' . $value . '</td>';
elseif ( intval( $value ) && $mode == 'icons' ):
$performance_id = sp_array_value( $performance_ids, $key, null );
if ( $performance_id && has_post_thumbnail( $performance_id ) ):
echo str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value );
endif;
endif;
endif;
endforeach;
endforeach;
if ( $mode == 'icons' ); echo '</td>';
echo '</tr>';
$i++;
endforeach;
?>
</tbody>
<?php endif; ?>
<?php if ( $status == 'results' && get_option( 'sportspress_event_show_total', 'yes' ) == 'yes' && array_key_exists( 0, $data ) ): ?>
<<?php echo ( $show_players && $has_players ? 'tfoot' : 'tbody' ); ?>>
<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">
<?php
if ( $has_players ):
echo '<td class="data-number">&nbsp;</td>';
echo '<td class="data-name">' . __( 'Total', 'sportspress' ) . '</td>';
endif;
$row = $data[0];
if ( $mode == 'icons' ) echo '<td class="sp-performance-icons">';
foreach( $labels as $key => $label ):
if ( $key == 'name' )
continue;
if ( $key == 'position' ):
$value = '&mdash;';
elseif ( array_key_exists( $key, $row ) && $row[ $key ] != '' ):
$value = $row[ $key ];
else:
$value = sp_array_value( $totals, $key, 0 );
endif;
if ( $mode == 'values' ):
echo '<td class="data-' . $key . '">' . $value . '</td>';
elseif ( intval( $value ) && $mode == 'icons' ):
$performance_id = sp_array_value( $performance_ids, $key, null );
if ( $performance_id && has_post_thumbnail( $performance_id ) ):
echo str_repeat( get_the_post_thumbnail( $performance_id, 'sportspress-fit-mini' ) . ' ', $value );
endif;
endif;
endforeach;
if ( $mode == 'icons' ) echo '</td>';
?>
</tr>
</<?php echo ( $has_players ? 'tfoot' : 'tbody' ); ?>>
<?php endif; ?>
</table>
if ( $mode == 'icons' ) echo '</td>';
?>
</tr>
</<?php echo ( $has_players ? 'tfoot' : 'tbody' ); ?>>
<?php endif; ?>
</table>
</div>
</div>
<?php
endforeach;

View File

@@ -100,5 +100,7 @@ else:
$output .= '</tbody>' . '</table>' . '</div>';
endif;
echo $output;
?>
<div class="sp-template sp-template-event-results">
<?php echo $output; ?>
</div>

View File

@@ -32,25 +32,27 @@ foreach( $venues as $venue ):
$latitude = sp_array_value( $meta, 'sp_latitude', 0 );
$longitude = sp_array_value( $meta, 'sp_longitude', 0 );
?>
<h4 class="sp-table-caption"><?php _e( 'Venue', 'sportspress' ); ?></h4>
<table class="sp-data-table sp-event-venue">
<thead>
<tr>
<th><?php echo $name; ?></th>
</tr>
</thead>
<?php if ( $address != null || ( $show_maps && $latitude != null && $longitude != null ) ): ?>
<tbody>
<div class="sp-template sp-template-event-venue">
<h4 class="sp-table-caption"><?php _e( 'Venue', 'sportspress' ); ?></h4>
<table class="sp-data-table sp-event-venue">
<thead>
<tr>
<td><?php echo $address; ?></td>
<th><?php echo $name; ?></th>
</tr>
<?php if ( $show_maps && $latitude != null && $longitude != null ): ?>
</thead>
<?php if ( $address != null || ( $show_maps && $latitude != null && $longitude != null ) ): ?>
<tbody>
<tr>
<td><?php sp_get_template( 'venue-map.php', array( 'meta' => $meta ) ); ?></td>
<td><?php echo $address; ?></td>
</tr>
<?php endif; ?>
</tbody>
<?php endif; ?>
</table>
<?php if ( $show_maps && $latitude != null && $longitude != null ): ?>
<tr>
<td><?php sp_get_template( 'venue-map.php', array( 'meta' => $meta ) ); ?></td>
</tr>
<?php endif; ?>
</tbody>
<?php endif; ?>
</table>
</div>
<?php
endforeach;

View File

@@ -14,6 +14,12 @@ if ( ! isset( $id ) )
$video_url = get_post_meta( $id, 'sp_video', true );
if ( $video_url ):
global $wp_embed;
echo $wp_embed->autoembed( $video_url );
?>
<div class="sp-event-video">
<?php
global $wp_embed;
echo $wp_embed->autoembed( $video_url );
?>
</div>
<?php
endif;

View File

@@ -153,4 +153,7 @@ $output .= '</div>';
if ( $show_full_table_link )
$output .= '<a class="sp-league-table-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . __( 'View full table', 'sportspress' ) . '</a>';
echo $output;
?>
<div class="sp-template sp-template-league-table">
<?php echo $output; ?>
</div>

View File

@@ -63,5 +63,5 @@ foreach( $data as $label => $value ):
endforeach;
$output .= '</dl></div>';
echo apply_filters( 'sportspress_player_details', $output );
?>
<?php echo $output; ?>

View File

@@ -91,56 +91,61 @@ if ( apply_filters( 'use_default_gallery_style', true ) )
</style>";
$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" . $gallery_div );
echo apply_filters( 'gallery_style', $gallery_style . "\n\t\t" );
?>
<div class="sp-template sp-template-player-gallery">
<?php echo $gallery_div; ?>
<?php
if ( intval( $number ) > 0 )
$limit = $number;
if ( intval( $number ) > 0 )
$limit = $number;
if ( $grouping === 'position' ):
$groups = get_terms( 'sp_position', array( 'orderby' => 'slug' ) );
else:
$group = new stdClass();
$group->term_id = null;
$group->name = null;
$group->slug = null;
$groups = array( $group );
endif;
foreach ( $groups as $group ):
$i = 0;
if ( ! empty( $group->name ) ):
echo '<a name="group-' . $group->slug . '" id="group-' . $group->slug . '"></a>';
echo '<' . $grouptag . ' class="player-group-name player-gallery-group-name">' . $group->name . '</' . $grouptag . '>';
if ( $grouping === 'position' ):
$groups = get_terms( 'sp_position', array( 'orderby' => 'slug' ) );
else:
$group = new stdClass();
$group->term_id = null;
$group->name = null;
$group->slug = null;
$groups = array( $group );
endif;
foreach( $data as $player_id => $performance ): if ( empty( $group->term_id ) || has_term( $group->term_id, 'sp_position', $player_id ) ):
foreach ( $groups as $group ):
$i = 0;
if ( isset( $limit ) && $i >= $limit ) continue;
if ( ! empty( $group->name ) ):
echo '<a name="group-' . $group->slug . '" id="group-' . $group->slug . '"></a>';
echo '<' . $grouptag . ' class="player-group-name player-gallery-group-name">' . $group->name . '</' . $grouptag . '>';
endif;
$caption = get_the_title( $player_id );
$caption = trim( $caption );
foreach( $data as $player_id => $performance ): if ( empty( $group->term_id ) || has_term( $group->term_id, 'sp_position', $player_id ) ):
sp_get_template( 'player-gallery-thumbnail.php', array(
'id' => $player_id,
'performance' => $performance,
'itemtag' => $itemtag,
'icontag' => $icontag,
'captiontag' => $captiontag,
'caption' => $caption,
'size' => $size,
'link_posts' => $link_posts,
) );
if ( isset( $limit ) && $i >= $limit ) continue;
$i++;
$caption = get_the_title( $player_id );
$caption = trim( $caption );
endif; endforeach;
sp_get_template( 'player-gallery-thumbnail.php', array(
'id' => $player_id,
'performance' => $performance,
'itemtag' => $itemtag,
'icontag' => $icontag,
'captiontag' => $captiontag,
'caption' => $caption,
'size' => $size,
'link_posts' => $link_posts,
) );
echo '<br style="clear: both;" />';
$i++;
endforeach;
endif; endforeach;
echo "</div>\n";
echo '<br style="clear: both;" />';
if ( $show_all_players_link )
echo '<a class="sp-player-list-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . __( 'View all players', 'sportspress' ) . '</a>';
endforeach;
echo "</div>\n";
if ( $show_all_players_link )
echo '<a class="sp-player-list-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . __( 'View all players', 'sportspress' ) . '</a>';
?>
</div>

View File

@@ -162,5 +162,7 @@ endforeach;
if ( $show_all_players_link )
$output .= '<a class="sp-player-list-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . __( 'View all players', 'sportspress' ) . '</a>';
echo apply_filters( 'sportspress_player_list', $output );
?>
<div class="sp-template sp-template-player-list">
<?php echo $output; ?>
</div>

View File

@@ -60,7 +60,10 @@ if ( is_array( $leagues ) ):
endforeach;
$output .= '</tbody>' . '</table>' . '</div>';
echo apply_filters( 'sportspress_player_statistics', $output );
?>
<div class="sp-template sp-template-player-statistics">
<?php echo $output; ?>
</div>
<?php
endforeach;
endif;

View File

@@ -53,5 +53,7 @@ foreach( $data as $label => $value ):
endforeach;
$output .= '</dl></div>';
echo apply_filters( 'sportspress_staff_details', $output );
?>
<div class="sp-template sp-template-staff-details">
<?php echo $output; ?>
</div>

View File

@@ -67,4 +67,7 @@ foreach ( $leagues as $league ):
endforeach;
echo apply_filters( 'sportspress_team_columns', $output );
?>
<div class="sp-template sp-template-team-columns">
<?php echo $output; ?>
</div>