Apply event and player settings
This commit is contained in:
@@ -58,7 +58,7 @@ class SP_Settings_Events extends SP_Settings_Page {
|
||||
array(
|
||||
'title' => __( 'Venue', 'sportspress' ),
|
||||
'desc' => __( 'Display maps', 'sportspress' ),
|
||||
'id' => 'sportspress_event_show_map',
|
||||
'id' => 'sportspress_event_show_maps',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
'checkboxgroup' => 'start',
|
||||
|
||||
@@ -42,8 +42,8 @@ class SP_Settings_Players extends SP_Settings_Page {
|
||||
|
||||
array(
|
||||
'title' => __( 'Nationality', 'sportspress' ),
|
||||
'desc' => __( 'Display national flag', 'sportspress' ),
|
||||
'id' => 'sportspress_player_show_flag',
|
||||
'desc' => __( 'Display national flags', 'sportspress' ),
|
||||
'id' => 'sportspress_player_show_flags',
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
),
|
||||
|
||||
@@ -4,7 +4,8 @@ if ( ! isset( $id ) )
|
||||
|
||||
$venues = get_the_terms( $id, 'sp_venue' );
|
||||
|
||||
$show_map = get_option( 'sportspress_event_show_map', 'yes' ) == 'yes' ? true : false;
|
||||
$show_maps = get_option( 'sportspress_event_show_maps', 'yes' ) == 'yes' ? true : false;
|
||||
$link_venues = get_option( 'sportspress_event_link_venues', 'no' ) == 'yes' ? true : false;
|
||||
|
||||
if ( ! $venues )
|
||||
return $output;
|
||||
@@ -13,6 +14,10 @@ foreach( $venues as $venue ):
|
||||
$t_id = $venue->term_id;
|
||||
$term_meta = get_option( "taxonomy_$t_id" );
|
||||
|
||||
$name = $venue->name;
|
||||
if ( $link_venues )
|
||||
$name = '<a href="' . get_term_link( $t_id, 'sp_venue' ) . '">' . $name . '</a>';
|
||||
|
||||
$address = sp_array_value( $term_meta, 'sp_address', '' );
|
||||
$latitude = sp_array_value( $term_meta, 'sp_latitude', 0 );
|
||||
$longitude = sp_array_value( $term_meta, 'sp_longitude', 0 );
|
||||
@@ -21,14 +26,14 @@ foreach( $venues as $venue ):
|
||||
<table class="sp-data-table sp-event-venue">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><a href="<?php echo get_term_link( $t_id, 'sp_venue' ); ?>"><?php echo $venue->name; ?></a></th>
|
||||
<th><?php echo $name; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><?php echo $address; ?></td>
|
||||
</tr>
|
||||
<?php if ( $show_map && $latitude != null && $longitude != null ): ?>
|
||||
<?php if ( $show_maps && $latitude != null && $longitude != null ): ?>
|
||||
<tr>
|
||||
<td><div class="sp-google-map" data-address="<?php echo $address; ?>" data-latitude="<?php echo $latitude; ?>" data-longitude="<?php echo $longitude; ?>"></div></td>
|
||||
</tr>
|
||||
|
||||
@@ -10,6 +10,7 @@ $defaults = array(
|
||||
'columns' => 3,
|
||||
'size' => 'thumbnail',
|
||||
'show_all_players_link' => false,
|
||||
'link_posts' => get_option( 'sportspress_list_link_players', 'yes' ) == 'yes' ? true : false,
|
||||
);
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
@@ -87,10 +88,19 @@ if ( is_int( $number ) && $number > 0 )
|
||||
foreach( $data as $player_id => $performance ):
|
||||
|
||||
$caption = get_the_title( $player_id );
|
||||
$caption = trim( $caption );
|
||||
|
||||
// Add player number to caption if available
|
||||
$player_number = get_post_meta( $player_id, 'sp_number', true );
|
||||
if ( $player_number ):
|
||||
if ( $player_number )
|
||||
$caption = '<strong>' . $player_number . '</strong> ' . $caption;
|
||||
endif;
|
||||
|
||||
// Add caption tag if has caption
|
||||
if ( $captiontag && $caption )
|
||||
$caption = '<' . $captiontag . ' class="wp-caption-text gallery-caption">' . wptexturize( $caption ) . '</' . $captiontag . '>';
|
||||
|
||||
if ( $link_posts )
|
||||
$caption = '<a href="' . get_permalink( $player_id ) . '">' . $caption . '</a>';
|
||||
|
||||
if ( isset( $limit ) && $i >= $limit )
|
||||
continue;
|
||||
@@ -103,12 +113,7 @@ foreach( $data as $player_id => $performance ):
|
||||
<{$icontag} class='gallery-icon portrait'>"
|
||||
. '<a href="' . get_permalink( $player_id ) . '">' . $thumbnail . '</a>'
|
||||
. "</{$icontag}>";
|
||||
if ( $captiontag && trim( $caption ) ) {
|
||||
$output .= '<a href="' . get_permalink( $player_id ) . '">' . "
|
||||
<{$captiontag} class='wp-caption-text gallery-caption'>
|
||||
" . wptexturize($caption) . "
|
||||
</{$captiontag}>" . '</a>';
|
||||
}
|
||||
$output .= $caption;
|
||||
$output .= "</{$itemtag}>";
|
||||
if ( $columns > 0 && ++$i % $columns == 0 )
|
||||
$output .= '<br style="clear: both" />';
|
||||
|
||||
@@ -3,7 +3,7 @@ if ( ! isset( $id ) )
|
||||
$id = get_the_ID();
|
||||
|
||||
$defaults = array(
|
||||
'show_nationality_flag' => get_option( 'sportspress_player_show_flag', 'yes' ) == 'yes' ? true : false,
|
||||
'show_nationality_flags' => get_option( 'sportspress_player_show_flags', 'yes' ) == 'yes' ? true : false,
|
||||
);
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
@@ -18,7 +18,7 @@ $metrics = sp_get_player_metrics_data( $id );
|
||||
$common = array();
|
||||
if ( $nationality ):
|
||||
$country_name = sp_array_value( $countries, $nationality, null );
|
||||
$common[ SP()->text->string('Nationality', 'player') ] = $country_name ? ( $show_nationality_flag ? '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . '/assets/images/flags/' . strtolower( $nationality ) . '.png" alt="' . $nationality . '"> ' : '' ) . $country_name : '—';
|
||||
$common[ SP()->text->string('Nationality', 'player') ] = $country_name ? ( $show_nationality_flags ? '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . '/assets/images/flags/' . strtolower( $nationality ) . '.png" alt="' . $nationality . '"> ' : '' ) . $country_name : '—';
|
||||
endif;
|
||||
|
||||
$data = array_merge( $common, $metrics );
|
||||
|
||||
Reference in New Issue
Block a user