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 );
|
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' );
|
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-general.php' );
|
||||||
$settings[] = include( 'settings/class-sp-settings-events.php' );
|
$settings[] = include( 'settings/class-sp-settings-events.php' );
|
||||||
$settings[] = include( 'settings/class-sp-settings-teams.php' );
|
$settings[] = include( 'settings/class-sp-settings-teams.php' );
|
||||||
$settings[] = include( 'settings/class-sp-settings-players.php' );
|
|
||||||
$settings[] = include( 'settings/class-sp-settings-staff.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 );
|
$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_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_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_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
|
// Save Calendar Meta Boxes
|
||||||
add_action( 'sportspress_process_sp_calendar_meta', 'SP_Meta_Box_Calendar_Format::save', 10, 2 );
|
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_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_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_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' );
|
add_meta_box( 'sp_editordiv', __( 'Article', 'sportspress' ), 'SP_Meta_Box_Event_Editor::output', 'sp_event', 'normal', 'high' );
|
||||||
|
|
||||||
// Calendars
|
// Calendars
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* @author ThemeBoy
|
* @author ThemeBoy
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package SportsPress/Admin/Meta_Boxes
|
* @package SportsPress/Admin/Meta_Boxes
|
||||||
* @version 0.8.6
|
* @version 1.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
@@ -37,13 +37,17 @@ class SP_Meta_Box_Event_Teams {
|
|||||||
wp_dropdown_pages( $args );
|
wp_dropdown_pages( $args );
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
<ul id="sp_team-tabs" class="wp-tab-bar sp-tab-bar">
|
<?php
|
||||||
<li class="wp-tab-active"><a href="#sp_player-all"><?php _e( 'Players', 'sportspress' ); ?></a></li>
|
if ( SP()->mode == 'team' ):
|
||||||
<li class="wp-tab"><a href="#sp_staff-all"><?php _e( 'Staff', 'sportspress' ); ?></a></li>
|
?>
|
||||||
</ul>
|
<ul id="sp_team-tabs" class="wp-tab-bar sp-tab-bar">
|
||||||
<?php
|
<li class="wp-tab-active"><a href="#sp_player-all"><?php _e( 'Players', 'sportspress' ); ?></a></li>
|
||||||
sp_post_checklist( $post->ID, 'sp_player', 'block', 'sp_current_team', $i );
|
<li class="wp-tab"><a href="#sp_staff-all"><?php _e( 'Staff', 'sportspress' ); ?></a></li>
|
||||||
sp_post_checklist( $post->ID, 'sp_staff', 'none', 'sp_current_team', $i );
|
</ul>
|
||||||
|
<?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>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* @author ThemeBoy
|
* @author ThemeBoy
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package SportsPress/Admin
|
* @package SportsPress/Admin
|
||||||
* @version 0.8
|
* @version 1.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
@@ -42,25 +42,29 @@ class SP_Settings_Config extends SP_Settings_Page {
|
|||||||
*/
|
*/
|
||||||
public function get_settings() {
|
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( 'title' => __( 'Configure SportsPress', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'config_options' ),
|
||||||
|
|
||||||
array( 'type' => 'outcomes' ),
|
array( 'type' => 'outcomes' ),
|
||||||
|
|
||||||
array( 'type' => 'results' ),
|
array( 'type' => 'results' ),
|
||||||
|
);
|
||||||
|
|
||||||
array( 'type' => 'performance' ),
|
if ( SP()->mode == 'team' ) $settings[] = array( 'type' => 'performance' );
|
||||||
|
|
||||||
array( 'type' => 'columns' ),
|
$settings[] = array( 'type' => 'columns' );
|
||||||
|
|
||||||
array( 'type' => 'metrics' ),
|
if ( SP()->mode == 'team' ):
|
||||||
|
$settings = array_merge( $settings, array(
|
||||||
|
array( 'type' => 'metrics' ),
|
||||||
|
|
||||||
array( 'type' => 'statistics' ),
|
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
|
* @author ThemeBoy
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package SportsPress/Admin
|
* @package SportsPress/Admin
|
||||||
* @version 1.0
|
* @version 1.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
|
|||||||
@@ -53,6 +53,16 @@ class SP_Settings_General extends SP_Settings_Page {
|
|||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'options' => $presets,
|
'options' => $presets,
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'title' => __( 'Mode', 'sportspress' ),
|
||||||
|
'id' => 'sportspress_mode',
|
||||||
|
'default' => 'team',
|
||||||
|
'type' => 'select',
|
||||||
|
'options' => array(
|
||||||
|
'team' => __( 'Team', 'sportspress' ),
|
||||||
|
'player' => __( 'Individual', 'sportspress' ),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Google Maps', 'sportspress' ),
|
'title' => __( 'Google Maps', 'sportspress' ),
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* @author ThemeBoy
|
* @author ThemeBoy
|
||||||
* @category Admin
|
* @category Admin
|
||||||
* @package SportsPress/Admin
|
* @package SportsPress/Admin
|
||||||
* @version 1.0
|
* @version 1.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
@@ -35,9 +35,7 @@ class SP_Settings_Players extends SP_Settings_Page {
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get_settings() {
|
public function get_settings() {
|
||||||
|
$settings = array(
|
||||||
return apply_filters( 'sportspress_player_settings', array(
|
|
||||||
|
|
||||||
array( 'title' => __( 'Player Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'player_options' ),
|
array( 'title' => __( 'Player Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'player_options' ),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
@@ -59,15 +57,19 @@ class SP_Settings_Players extends SP_Settings_Page {
|
|||||||
'default' => 'yes',
|
'default' => 'yes',
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
|
||||||
array(
|
if ( SP()->mode == 'team' ):
|
||||||
|
$settings[] = array(
|
||||||
'title' => __( 'Teams', 'sportspress' ),
|
'title' => __( 'Teams', 'sportspress' ),
|
||||||
'desc' => __( 'Link teams', 'sportspress' ),
|
'desc' => __( 'Link teams', 'sportspress' ),
|
||||||
'id' => 'sportspress_list_link_teams',
|
'id' => 'sportspress_list_link_teams',
|
||||||
'default' => 'no',
|
'default' => 'no',
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
),
|
);
|
||||||
|
endif;
|
||||||
|
|
||||||
|
$settings = array_merge( $settings, array(
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Pagination', 'sportspress' ),
|
'title' => __( 'Pagination', 'sportspress' ),
|
||||||
'desc' => __( 'Paginate', 'sportspress' ),
|
'desc' => __( 'Paginate', 'sportspress' ),
|
||||||
@@ -90,8 +92,9 @@ class SP_Settings_Players extends SP_Settings_Page {
|
|||||||
),
|
),
|
||||||
|
|
||||||
array( 'type' => 'sectionend', 'id' => 'list_options' ),
|
array( 'type' => 'sectionend', 'id' => 'list_options' ),
|
||||||
|
|
||||||
)); // End player settings
|
)); // End player settings
|
||||||
|
|
||||||
|
return apply_filters( 'sportspress_player_settings', $settings );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -456,97 +456,99 @@ class SP_Post_types {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
register_post_type( 'sp_player',
|
if ( SP()->mode == 'team' ):
|
||||||
apply_filters( 'sportspress_register_post_type_player',
|
register_post_type( 'sp_player',
|
||||||
array(
|
apply_filters( 'sportspress_register_post_type_player',
|
||||||
'labels' => array(
|
array(
|
||||||
'name' => __( 'Players', 'sportspress' ),
|
'labels' => array(
|
||||||
'singular_name' => __( 'Player', 'sportspress' ),
|
'name' => __( 'Players', 'sportspress' ),
|
||||||
'add_new_item' => __( 'Add New Player', 'sportspress' ),
|
'singular_name' => __( 'Player', 'sportspress' ),
|
||||||
'edit_item' => __( 'Edit Player', 'sportspress' ),
|
'add_new_item' => __( 'Add New Player', 'sportspress' ),
|
||||||
'new_item' => __( 'New', 'sportspress' ),
|
'edit_item' => __( 'Edit Player', 'sportspress' ),
|
||||||
'view_item' => __( 'View', 'sportspress' ),
|
'new_item' => __( 'New', 'sportspress' ),
|
||||||
'search_items' => __( 'Search', 'sportspress' ),
|
'view_item' => __( 'View', 'sportspress' ),
|
||||||
'not_found' => __( 'No results found.', 'sportspress' ),
|
'search_items' => __( 'Search', 'sportspress' ),
|
||||||
'not_found_in_trash' => __( 'No results found.', 'sportspress' ),
|
'not_found' => __( 'No results found.', 'sportspress' ),
|
||||||
),
|
'not_found_in_trash' => __( 'No results found.', 'sportspress' ),
|
||||||
'public' => true,
|
),
|
||||||
'show_ui' => true,
|
'public' => true,
|
||||||
'capability_type' => 'sp_player',
|
'show_ui' => true,
|
||||||
'map_meta_cap' => true,
|
'capability_type' => 'sp_player',
|
||||||
'publicly_queryable' => true,
|
'map_meta_cap' => true,
|
||||||
'exclude_from_search' => false,
|
'publicly_queryable' => true,
|
||||||
'hierarchical' => false,
|
'exclude_from_search' => false,
|
||||||
'rewrite' => array( 'slug' => get_option( 'sportspress_player_slug', 'player' ) ),
|
'hierarchical' => false,
|
||||||
'supports' => array( 'title', 'author', 'thumbnail', 'excerpt', 'page-attributes' ),
|
'rewrite' => array( 'slug' => get_option( 'sportspress_player_slug', 'player' ) ),
|
||||||
'has_archive' => false,
|
'supports' => array( 'title', 'author', 'thumbnail', 'excerpt', 'page-attributes' ),
|
||||||
'show_in_nav_menus' => true,
|
'has_archive' => false,
|
||||||
'menu_icon' => 'dashicons-groups',
|
'show_in_nav_menus' => true,
|
||||||
|
'menu_icon' => 'dashicons-groups',
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
);
|
|
||||||
|
|
||||||
register_post_type( 'sp_list',
|
register_post_type( 'sp_list',
|
||||||
apply_filters( 'sportspress_register_post_type_list',
|
apply_filters( 'sportspress_register_post_type_list',
|
||||||
array(
|
array(
|
||||||
'labels' => array(
|
'labels' => array(
|
||||||
'name' => __( 'Player Lists', 'sportspress' ),
|
'name' => __( 'Player Lists', 'sportspress' ),
|
||||||
'singular_name' => __( 'Player List', 'sportspress' ),
|
'singular_name' => __( 'Player List', 'sportspress' ),
|
||||||
'add_new_item' => __( 'Add New Player List', 'sportspress' ),
|
'add_new_item' => __( 'Add New Player List', 'sportspress' ),
|
||||||
'edit_item' => __( 'Edit Player List', 'sportspress' ),
|
'edit_item' => __( 'Edit Player List', 'sportspress' ),
|
||||||
'new_item' => __( 'New', 'sportspress' ),
|
'new_item' => __( 'New', 'sportspress' ),
|
||||||
'view_item' => __( 'View', 'sportspress' ),
|
'view_item' => __( 'View', 'sportspress' ),
|
||||||
'search_items' => __( 'Search', 'sportspress' ),
|
'search_items' => __( 'Search', 'sportspress' ),
|
||||||
'not_found' => __( 'No results found.', 'sportspress' ),
|
'not_found' => __( 'No results found.', 'sportspress' ),
|
||||||
'not_found_in_trash' => __( 'No results found.', 'sportspress' ),
|
'not_found_in_trash' => __( 'No results found.', 'sportspress' ),
|
||||||
),
|
),
|
||||||
'public' => true,
|
'public' => true,
|
||||||
'show_ui' => true,
|
'show_ui' => true,
|
||||||
'capability_type' => 'sp_list',
|
'capability_type' => 'sp_list',
|
||||||
'map_meta_cap' => true,
|
'map_meta_cap' => true,
|
||||||
'publicly_queryable' => true,
|
'publicly_queryable' => true,
|
||||||
'exclude_from_search' => false,
|
'exclude_from_search' => false,
|
||||||
'hierarchical' => false,
|
'hierarchical' => false,
|
||||||
'rewrite' => array( 'slug' => get_option( 'sportspress_list_slug', 'list' ) ),
|
'rewrite' => array( 'slug' => get_option( 'sportspress_list_slug', 'list' ) ),
|
||||||
'supports' => array( 'title', 'author', 'thumbnail' ),
|
'supports' => array( 'title', 'author', 'thumbnail' ),
|
||||||
'has_archive' => false,
|
'has_archive' => false,
|
||||||
'show_in_nav_menus' => true,
|
'show_in_nav_menus' => true,
|
||||||
'show_in_menu' => 'edit.php?post_type=sp_player',
|
'show_in_menu' => 'edit.php?post_type=sp_player',
|
||||||
'show_in_admin_bar' => true,
|
'show_in_admin_bar' => true,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
);
|
|
||||||
|
|
||||||
register_post_type( 'sp_staff',
|
register_post_type( 'sp_staff',
|
||||||
apply_filters( 'sportspress_register_post_type_staff',
|
apply_filters( 'sportspress_register_post_type_staff',
|
||||||
array(
|
array(
|
||||||
'labels' => array(
|
'labels' => array(
|
||||||
'name' => __( 'Staff', 'sportspress' ),
|
'name' => __( 'Staff', 'sportspress' ),
|
||||||
'singular_name' => __( 'Staff', 'sportspress' ),
|
'singular_name' => __( 'Staff', 'sportspress' ),
|
||||||
'add_new_item' => __( 'Add New Staff', 'sportspress' ),
|
'add_new_item' => __( 'Add New Staff', 'sportspress' ),
|
||||||
'edit_item' => __( 'Edit Staff', 'sportspress' ),
|
'edit_item' => __( 'Edit Staff', 'sportspress' ),
|
||||||
'new_item' => __( 'New', 'sportspress' ),
|
'new_item' => __( 'New', 'sportspress' ),
|
||||||
'view_item' => __( 'View', 'sportspress' ),
|
'view_item' => __( 'View', 'sportspress' ),
|
||||||
'search_items' => __( 'Search', 'sportspress' ),
|
'search_items' => __( 'Search', 'sportspress' ),
|
||||||
'not_found' => __( 'No results found.', 'sportspress' ),
|
'not_found' => __( 'No results found.', 'sportspress' ),
|
||||||
'not_found_in_trash' => __( 'No results found.', 'sportspress' ),
|
'not_found_in_trash' => __( 'No results found.', 'sportspress' ),
|
||||||
),
|
),
|
||||||
'public' => true,
|
'public' => true,
|
||||||
'show_ui' => true,
|
'show_ui' => true,
|
||||||
'capability_type' => 'sp_staff',
|
'capability_type' => 'sp_staff',
|
||||||
'map_meta_cap' => true,
|
'map_meta_cap' => true,
|
||||||
'publicly_queryable' => true,
|
'publicly_queryable' => true,
|
||||||
'exclude_from_search' => false,
|
'exclude_from_search' => false,
|
||||||
'hierarchical' => false,
|
'hierarchical' => false,
|
||||||
'rewrite' => array( 'slug' => get_option( 'sportspress_staff_slug', 'staff' ) ),
|
'rewrite' => array( 'slug' => get_option( 'sportspress_staff_slug', 'staff' ) ),
|
||||||
'supports' => array( 'title', 'author', 'thumbnail', 'excerpt' ),
|
'supports' => array( 'title', 'author', 'thumbnail', 'excerpt' ),
|
||||||
'has_archive' => false,
|
'has_archive' => false,
|
||||||
'show_in_nav_menus' => true,
|
'show_in_nav_menus' => true,
|
||||||
'show_in_menu' => 'edit.php?post_type=sp_player',
|
'show_in_menu' => 'edit.php?post_type=sp_player',
|
||||||
'show_in_admin_bar' => true,
|
'show_in_admin_bar' => true,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
);
|
endif;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_scheduled_events( $posts ) {
|
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' ) ) {
|
if ( !function_exists( 'sp_array_between' ) ) {
|
||||||
function sp_array_between ( $array = array(), $delimiter = 0, $index = 0 ) {
|
function sp_array_between ( $array = array(), $delimiter = 0, $index = 0 ) {
|
||||||
$keys = array_keys( $array, $delimiter );
|
$keys = array_keys( $array, $delimiter );
|
||||||
@@ -2482,25 +2491,19 @@ function sp_get_sport_presets() {
|
|||||||
function sp_get_text_options() {
|
function sp_get_text_options() {
|
||||||
$strings = apply_filters( 'sportspress_text', array(
|
$strings = apply_filters( 'sportspress_text', array(
|
||||||
__( 'Article', 'sportspress' ),
|
__( 'Article', 'sportspress' ),
|
||||||
__( 'Current Team', 'sportspress' ),
|
|
||||||
__( 'Date', 'sportspress' ),
|
__( 'Date', 'sportspress' ),
|
||||||
__( 'Details', 'sportspress' ),
|
__( 'Details', 'sportspress' ),
|
||||||
__( 'Event', 'sportspress' ),
|
__( 'Event', 'sportspress' ),
|
||||||
__( 'League', 'sportspress' ),
|
__( 'League', 'sportspress' ),
|
||||||
__( 'Nationality', 'sportspress' ),
|
__( 'Nationality', 'sportspress' ),
|
||||||
__( 'Outcome', 'sportspress' ),
|
__( 'Outcome', 'sportspress' ),
|
||||||
__( 'Past Teams', 'sportspress' ),
|
|
||||||
__( 'Played', 'sportspress' ),
|
__( 'Played', 'sportspress' ),
|
||||||
__( 'Player', 'sportspress' ),
|
|
||||||
__( 'Pos', 'sportspress' ),
|
__( 'Pos', 'sportspress' ),
|
||||||
__( 'Position', 'sportspress' ),
|
|
||||||
__( 'Preview', 'sportspress' ),
|
__( 'Preview', 'sportspress' ),
|
||||||
__( 'Rank', 'sportspress' ),
|
__( 'Rank', 'sportspress' ),
|
||||||
__( 'Recap', 'sportspress' ),
|
__( 'Recap', 'sportspress' ),
|
||||||
__( 'Team Results', 'sportspress' ),
|
__( 'Team Results', 'sportspress' ),
|
||||||
__( 'Season', 'sportspress' ),
|
__( 'Season', 'sportspress' ),
|
||||||
__( 'Staff', 'sportspress' ),
|
|
||||||
__( 'Substitutes', 'sportspress' ),
|
|
||||||
__( 'Team', 'sportspress' ),
|
__( 'Team', 'sportspress' ),
|
||||||
__( 'Teams', 'sportspress' ),
|
__( 'Teams', 'sportspress' ),
|
||||||
__( 'Time', 'sportspress' ),
|
__( 'Time', 'sportspress' ),
|
||||||
@@ -2508,9 +2511,21 @@ function sp_get_text_options() {
|
|||||||
__( 'Total', 'sportspress' ),
|
__( 'Total', 'sportspress' ),
|
||||||
__( 'Venue', 'sportspress' ),
|
__( 'Venue', 'sportspress' ),
|
||||||
__( 'View all events', 'sportspress' ),
|
__( 'View all events', 'sportspress' ),
|
||||||
__( 'View all players', 'sportspress' ),
|
|
||||||
__( 'View full table', '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 );
|
asort( $strings );
|
||||||
return $strings;
|
return $strings;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ if ( ! function_exists( 'sportspress_output_event_performance' ) ) {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function sportspress_output_event_performance() {
|
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();
|
public $text = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $mode = 'team';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main SportsPress Instance
|
* Main SportsPress Instance
|
||||||
*
|
*
|
||||||
@@ -117,6 +122,7 @@ final class SportsPress {
|
|||||||
add_action( 'init', array( $this, 'include_template_functions' ) );
|
add_action( 'init', array( $this, 'include_template_functions' ) );
|
||||||
add_action( 'init', array( 'SP_Shortcodes', 'init' ) );
|
add_action( 'init', array( 'SP_Shortcodes', 'init' ) );
|
||||||
add_action( 'after_setup_theme', array( $this, 'setup_environment' ) );
|
add_action( 'after_setup_theme', array( $this, 'setup_environment' ) );
|
||||||
|
add_filter( 'gettext', array( $this, 'gettext' ), 20, 3 );
|
||||||
|
|
||||||
// Loaded action
|
// Loaded action
|
||||||
do_action( 'sportspress_loaded' );
|
do_action( 'sportspress_loaded' );
|
||||||
@@ -264,6 +270,9 @@ final class SportsPress {
|
|||||||
// Load string options
|
// Load string options
|
||||||
$this->text = get_option( 'sportspress_text', array() );
|
$this->text = get_option( 'sportspress_text', array() );
|
||||||
|
|
||||||
|
// Get mode option
|
||||||
|
$this->mode = sp_get_option( 'sportspress_mode', 'team' );
|
||||||
|
|
||||||
// Init action
|
// Init action
|
||||||
do_action( 'sportspress_init' );
|
do_action( 'sportspress_init' );
|
||||||
}
|
}
|
||||||
@@ -307,6 +316,44 @@ final class SportsPress {
|
|||||||
add_image_size( 'sportspress-fit-mini', 32, 32, false );
|
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 ******************************************************/
|
/** Helper functions ******************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user