Apply default sport and fix empty positions in wizard
This commit is contained in:
@@ -442,8 +442,9 @@ class SP_Admin_Settings {
|
|||||||
// Select sport
|
// Select sport
|
||||||
case 'sport' :
|
case 'sport' :
|
||||||
|
|
||||||
|
$default = apply_filters( 'sportspress_default_sport', 'soccer' );
|
||||||
$option_value = self::get_option( $value['id'], $value['default'] );
|
$option_value = self::get_option( $value['id'], $value['default'] );
|
||||||
if ( 'none' === $option_value ) $option_value = 'soccer';
|
if ( 'none' === $option_value ) $option_value = $default;
|
||||||
|
|
||||||
$categories = SP_Admin_Sports::sport_category_names();
|
$categories = SP_Admin_Sports::sport_category_names();
|
||||||
|
|
||||||
|
|||||||
@@ -255,8 +255,9 @@ class WC_Admin_Setup_Wizard {
|
|||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
$options = SP_Admin_Sports::get_preset_options();
|
$options = SP_Admin_Sports::get_preset_options();
|
||||||
$default = get_option( 'sportspress_sport', 'soccer' );
|
$default = apply_filters( 'sportspress_default_sport', 'soccer' );
|
||||||
if ( 'none' === $default ) $default = 'soccer';
|
$sport = get_option( 'sportspress_sport', $default );
|
||||||
|
if ( 'none' === $sport ) $sport = $default;
|
||||||
$categories = SP_Admin_Sports::sport_category_names();
|
$categories = SP_Admin_Sports::sport_category_names();
|
||||||
?>
|
?>
|
||||||
<select name="sport" id="sport" class="sp-select-sport <?php echo esc_attr( $class ); ?>">
|
<select name="sport" id="sport" class="sp-select-sport <?php echo esc_attr( $class ); ?>">
|
||||||
@@ -267,7 +268,7 @@ class WC_Admin_Setup_Wizard {
|
|||||||
<?php
|
<?php
|
||||||
foreach ( $options as $key => $val ) {
|
foreach ( $options as $key => $val ) {
|
||||||
?>
|
?>
|
||||||
<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $default, $key ); ?>><?php echo $val ?></option>
|
<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $sport, $key ); ?>><?php echo $val ?></option>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -409,7 +410,7 @@ class WC_Admin_Setup_Wizard {
|
|||||||
* Players & Staff Setup.
|
* Players & Staff Setup.
|
||||||
*/
|
*/
|
||||||
public function sp_setup_players_staff() {
|
public function sp_setup_players_staff() {
|
||||||
$positions = get_terms( 'sp_position', array( 'hide_empty' => 0, 'orderby' => 'slug', 'fields' => 'names' ) )
|
$positions = (array) get_terms( 'sp_position', array( 'hide_empty' => 0, 'orderby' => 'slug', 'fields' => 'names' ) )
|
||||||
?>
|
?>
|
||||||
<h1><?php esc_html_e( 'Player & Staff Setup', 'sportspress' ); ?></h1>
|
<h1><?php esc_html_e( 'Player & Staff Setup', 'sportspress' ); ?></h1>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
|||||||
Reference in New Issue
Block a user