Enable individual sport mode
This commit is contained in:
@@ -60,6 +60,11 @@ class SP_Admin_Assets {
|
||||
wp_enqueue_style( 'sportspress-admin-equation-styles', SP()->plugin_url() . '/assets/css/equation.css', array(), SP_VERSION );
|
||||
}
|
||||
|
||||
if ( SP()->mode == 'player' ):
|
||||
$custom_css = '#adminmenu #menu-posts-sp_team .menu-icon-sp_team div.wp-menu-image:before,.sp-icon-shield:before{content: "\f307"}';
|
||||
wp_add_inline_style( 'sportspress-admin-menu-styles', $custom_css );
|
||||
endif;
|
||||
|
||||
do_action( 'sportspress_admin_css' );
|
||||
}
|
||||
|
||||
|
||||
@@ -34,8 +34,11 @@ class SP_Admin_Settings {
|
||||
$settings[] = include( 'settings/class-sp-settings-general.php' );
|
||||
$settings[] = include( 'settings/class-sp-settings-events.php' );
|
||||
$settings[] = include( 'settings/class-sp-settings-teams.php' );
|
||||
|
||||
if ( SP()->mode == 'team' ):
|
||||
$settings[] = include( 'settings/class-sp-settings-players.php' );
|
||||
$settings[] = include( 'settings/class-sp-settings-staff.php' );
|
||||
endif;
|
||||
|
||||
$settings = apply_filters( 'sportspress_get_settings_pages', $settings );
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class SP_Admin_Meta_Boxes {
|
||||
add_action( 'sportspress_process_sp_event_meta', 'SP_Meta_Box_Event_Teams::save', 30, 2 );
|
||||
add_action( 'sportspress_process_sp_event_meta', 'SP_Meta_Box_Event_Video::save', 40, 2 );
|
||||
add_action( 'sportspress_process_sp_event_meta', 'SP_Meta_Box_Event_Results::save', 50, 2 );
|
||||
add_action( 'sportspress_process_sp_event_meta', 'SP_Meta_Box_Event_Performance::save', 60, 2 );
|
||||
if ( SP()->mode == 'team' ) add_action( 'sportspress_process_sp_event_meta', 'SP_Meta_Box_Event_Performance::save', 60, 2 );
|
||||
|
||||
// Save Calendar Meta Boxes
|
||||
add_action( 'sportspress_process_sp_calendar_meta', 'SP_Meta_Box_Calendar_Format::save', 10, 2 );
|
||||
@@ -114,7 +114,7 @@ class SP_Admin_Meta_Boxes {
|
||||
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'SP_Meta_Box_Event_Teams::output', 'sp_event', 'side', 'default' );
|
||||
add_meta_box( 'sp_videodiv', __( 'Video', 'sportspress' ), 'SP_Meta_Box_Event_Video::output', 'sp_event', 'side', 'low' );
|
||||
add_meta_box( 'sp_resultsdiv', __( 'Team Results', 'sportspress' ), 'SP_Meta_Box_Event_Results::output', 'sp_event', 'normal', 'high' );
|
||||
add_meta_box( 'sp_performancediv', __( 'Player Performance', 'sportspress' ), 'SP_Meta_Box_Event_Performance::output', 'sp_event', 'normal', 'high' );
|
||||
if ( SP()->mode == 'team' ) add_meta_box( 'sp_performancediv', __( 'Player Performance', 'sportspress' ), 'SP_Meta_Box_Event_Performance::output', 'sp_event', 'normal', 'high' );
|
||||
add_meta_box( 'sp_editordiv', __( 'Article', 'sportspress' ), 'SP_Meta_Box_Event_Editor::output', 'sp_event', 'normal', 'high' );
|
||||
|
||||
// Calendars
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @author ThemeBoy
|
||||
* @category Admin
|
||||
* @package SportsPress/Admin/Meta_Boxes
|
||||
* @version 0.8.6
|
||||
* @version 1.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
@@ -37,6 +37,9 @@ class SP_Meta_Box_Event_Teams {
|
||||
wp_dropdown_pages( $args );
|
||||
?>
|
||||
</p>
|
||||
<?php
|
||||
if ( SP()->mode == 'team' ):
|
||||
?>
|
||||
<ul id="sp_team-tabs" class="wp-tab-bar sp-tab-bar">
|
||||
<li class="wp-tab-active"><a href="#sp_player-all"><?php _e( 'Players', 'sportspress' ); ?></a></li>
|
||||
<li class="wp-tab"><a href="#sp_staff-all"><?php _e( 'Staff', 'sportspress' ); ?></a></li>
|
||||
@@ -44,6 +47,7 @@ class SP_Meta_Box_Event_Teams {
|
||||
<?php
|
||||
sp_post_checklist( $post->ID, 'sp_player', 'block', 'sp_current_team', $i );
|
||||
sp_post_checklist( $post->ID, 'sp_staff', 'none', 'sp_current_team', $i );
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @author ThemeBoy
|
||||
* @category Admin
|
||||
* @package SportsPress/Admin
|
||||
* @version 0.8
|
||||
* @version 1.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
@@ -42,25 +42,29 @@ class SP_Settings_Config extends SP_Settings_Page {
|
||||
*/
|
||||
public function get_settings() {
|
||||
|
||||
return apply_filters('sportspress_config_settings', array(
|
||||
|
||||
$settings = array(
|
||||
array( 'title' => __( 'Configure SportsPress', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'config_options' ),
|
||||
|
||||
array( 'type' => 'outcomes' ),
|
||||
|
||||
array( 'type' => 'results' ),
|
||||
);
|
||||
|
||||
array( 'type' => 'performance' ),
|
||||
if ( SP()->mode == 'team' ) $settings[] = array( 'type' => 'performance' );
|
||||
|
||||
array( 'type' => 'columns' ),
|
||||
$settings[] = array( 'type' => 'columns' );
|
||||
|
||||
if ( SP()->mode == 'team' ):
|
||||
$settings = array_merge( $settings, array(
|
||||
array( 'type' => 'metrics' ),
|
||||
|
||||
array( 'type' => 'statistics' ),
|
||||
));
|
||||
endif;
|
||||
|
||||
array( 'type' => 'sectionend', 'id' => 'config_options' ),
|
||||
$settings[] = array( 'type' => 'sectionend', 'id' => 'config_options' ); // End event settings
|
||||
|
||||
)); // End event settings
|
||||
return apply_filters( 'sportspress_config_settings', $settings );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @author ThemeBoy
|
||||
* @category Admin
|
||||
* @package SportsPress/Admin
|
||||
* @version 1.0
|
||||
* @version 1.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
@@ -53,6 +53,16 @@ class SP_Settings_General extends SP_Settings_Page {
|
||||
'type' => 'select',
|
||||
'options' => $presets,
|
||||
),
|
||||
array(
|
||||
'title' => __( 'Mode', 'sportspress' ),
|
||||
'id' => 'sportspress_mode',
|
||||
'default' => 'team',
|
||||
'type' => 'select',
|
||||
'options' => array(
|
||||
'team' => __( 'Team', 'sportspress' ),
|
||||
'player' => __( 'Individual', 'sportspress' ),
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'title' => __( 'Google Maps', 'sportspress' ),
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @author ThemeBoy
|
||||
* @category Admin
|
||||
* @package SportsPress/Admin
|
||||
* @version 1.0
|
||||
* @version 1.1
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
@@ -35,9 +35,7 @@ class SP_Settings_Players extends SP_Settings_Page {
|
||||
* @return array
|
||||
*/
|
||||
public function get_settings() {
|
||||
|
||||
return apply_filters( 'sportspress_player_settings', array(
|
||||
|
||||
$settings = array(
|
||||
array( 'title' => __( 'Player Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'player_options' ),
|
||||
|
||||
array(
|
||||
@@ -59,15 +57,19 @@ class SP_Settings_Players extends SP_Settings_Page {
|
||||
'default' => 'yes',
|
||||
'type' => 'checkbox',
|
||||
),
|
||||
);
|
||||
|
||||
array(
|
||||
if ( SP()->mode == 'team' ):
|
||||
$settings[] = array(
|
||||
'title' => __( 'Teams', 'sportspress' ),
|
||||
'desc' => __( 'Link teams', 'sportspress' ),
|
||||
'id' => 'sportspress_list_link_teams',
|
||||
'default' => 'no',
|
||||
'type' => 'checkbox',
|
||||
),
|
||||
);
|
||||
endif;
|
||||
|
||||
$settings = array_merge( $settings, array(
|
||||
array(
|
||||
'title' => __( 'Pagination', 'sportspress' ),
|
||||
'desc' => __( 'Paginate', 'sportspress' ),
|
||||
@@ -90,8 +92,9 @@ class SP_Settings_Players extends SP_Settings_Page {
|
||||
),
|
||||
|
||||
array( 'type' => 'sectionend', 'id' => 'list_options' ),
|
||||
|
||||
)); // End player settings
|
||||
|
||||
return apply_filters( 'sportspress_player_settings', $settings );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -456,6 +456,7 @@ class SP_Post_types {
|
||||
)
|
||||
);
|
||||
|
||||
if ( SP()->mode == 'team' ):
|
||||
register_post_type( 'sp_player',
|
||||
apply_filters( 'sportspress_register_post_type_player',
|
||||
array(
|
||||
@@ -547,6 +548,7 @@ class SP_Post_types {
|
||||
)
|
||||
)
|
||||
);
|
||||
endif;
|
||||
}
|
||||
|
||||
public function display_scheduled_events( $posts ) {
|
||||
|
||||
@@ -229,6 +229,15 @@ if ( !function_exists( 'sp_nonce' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( !function_exists( 'sp_get_option' ) ) {
|
||||
function sp_get_option( $option, $default = null ) {
|
||||
if ( isset( $_POST[ $option ] ) )
|
||||
return $_POST[ $option ];
|
||||
else
|
||||
return get_option( $option, $default );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !function_exists( 'sp_array_between' ) ) {
|
||||
function sp_array_between ( $array = array(), $delimiter = 0, $index = 0 ) {
|
||||
$keys = array_keys( $array, $delimiter );
|
||||
@@ -2482,25 +2491,19 @@ function sp_get_sport_presets() {
|
||||
function sp_get_text_options() {
|
||||
$strings = apply_filters( 'sportspress_text', array(
|
||||
__( 'Article', 'sportspress' ),
|
||||
__( 'Current Team', 'sportspress' ),
|
||||
__( 'Date', 'sportspress' ),
|
||||
__( 'Details', 'sportspress' ),
|
||||
__( 'Event', 'sportspress' ),
|
||||
__( 'League', 'sportspress' ),
|
||||
__( 'Nationality', 'sportspress' ),
|
||||
__( 'Outcome', 'sportspress' ),
|
||||
__( 'Past Teams', 'sportspress' ),
|
||||
__( 'Played', 'sportspress' ),
|
||||
__( 'Player', 'sportspress' ),
|
||||
__( 'Pos', 'sportspress' ),
|
||||
__( 'Position', 'sportspress' ),
|
||||
__( 'Preview', 'sportspress' ),
|
||||
__( 'Rank', 'sportspress' ),
|
||||
__( 'Recap', 'sportspress' ),
|
||||
__( 'Team Results', 'sportspress' ),
|
||||
__( 'Season', 'sportspress' ),
|
||||
__( 'Staff', 'sportspress' ),
|
||||
__( 'Substitutes', 'sportspress' ),
|
||||
__( 'Team', 'sportspress' ),
|
||||
__( 'Teams', 'sportspress' ),
|
||||
__( 'Time', 'sportspress' ),
|
||||
@@ -2508,9 +2511,21 @@ function sp_get_text_options() {
|
||||
__( 'Total', 'sportspress' ),
|
||||
__( 'Venue', 'sportspress' ),
|
||||
__( 'View all events', 'sportspress' ),
|
||||
__( 'View all players', 'sportspress' ),
|
||||
__( 'View full table', 'sportspress' ),
|
||||
));
|
||||
|
||||
if ( SP()->mode == 'team' ):
|
||||
$strings = array_merge( $strings, array(
|
||||
__( 'Current Team', 'sportspress' ),
|
||||
__( 'Past Teams', 'sportspress' ),
|
||||
__( 'Player', 'sportspress' ),
|
||||
__( 'Position', 'sportspress' ),
|
||||
__( 'Staff', 'sportspress' ),
|
||||
__( 'Substitutes', 'sportspress' ),
|
||||
__( 'View all players', 'sportspress' ),
|
||||
));
|
||||
endif;
|
||||
|
||||
asort( $strings );
|
||||
return $strings;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ if ( ! function_exists( 'sportspress_output_event_performance' ) ) {
|
||||
* @return void
|
||||
*/
|
||||
function sportspress_output_event_performance() {
|
||||
sp_get_template( 'event-performance.php' );
|
||||
if ( SP()->mode == 'team' ) sp_get_template( 'event-performance.php' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,11 @@ final class SportsPress {
|
||||
*/
|
||||
public $text = array();
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $mode = 'team';
|
||||
|
||||
/**
|
||||
* Main SportsPress Instance
|
||||
*
|
||||
@@ -117,6 +122,7 @@ final class SportsPress {
|
||||
add_action( 'init', array( $this, 'include_template_functions' ) );
|
||||
add_action( 'init', array( 'SP_Shortcodes', 'init' ) );
|
||||
add_action( 'after_setup_theme', array( $this, 'setup_environment' ) );
|
||||
add_filter( 'gettext', array( $this, 'gettext' ), 20, 3 );
|
||||
|
||||
// Loaded action
|
||||
do_action( 'sportspress_loaded' );
|
||||
@@ -264,6 +270,9 @@ final class SportsPress {
|
||||
// Load string options
|
||||
$this->text = get_option( 'sportspress_text', array() );
|
||||
|
||||
// Get mode option
|
||||
$this->mode = sp_get_option( 'sportspress_mode', 'team' );
|
||||
|
||||
// Init action
|
||||
do_action( 'sportspress_init' );
|
||||
}
|
||||
@@ -307,6 +316,44 @@ final class SportsPress {
|
||||
add_image_size( 'sportspress-fit-mini', 32, 32, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace team strings with player if individual mode.
|
||||
*/
|
||||
public function gettext( $translated_text, $untranslated_text, $domain ) {
|
||||
if ( SP()->mode == 'player' && $domain == 'sportspress' ):
|
||||
switch ( $untranslated_text ):
|
||||
case 'Teams':
|
||||
return __( 'Players', 'sportspress' );
|
||||
case 'Team':
|
||||
return __( 'Player', 'sportspress' );
|
||||
case 'teams':
|
||||
return __( 'players', 'sportspress' );
|
||||
case 'Add New Team':
|
||||
return __( 'Add New Player', 'sportspress' );
|
||||
case 'Edit Team':
|
||||
return __( 'Edit Player', 'sportspress' );
|
||||
case 'Team Options':
|
||||
return __( 'Player Options', 'sportspress' );
|
||||
case 'Team Results':
|
||||
return __( 'Player Performance', 'sportspress' );
|
||||
case 'Logo':
|
||||
return __( 'Photo', 'sportspress' );
|
||||
case 'Add logo':
|
||||
return __( 'Add photo', 'sportspress' );
|
||||
case 'Remove logo':
|
||||
return __( 'Remove photo', 'sportspress' );
|
||||
case 'Select Logo':
|
||||
return __( 'Select Photo', 'sportspress' );
|
||||
case 'Display logos':
|
||||
return __( 'Display photos', 'sportspress' );
|
||||
case 'Link teams':
|
||||
return __( 'Link players', 'sportspress' );
|
||||
endswitch;
|
||||
endif;
|
||||
|
||||
return $translated_text;
|
||||
}
|
||||
|
||||
/** Helper functions ******************************************************/
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user