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