Enable individual sport mode
This commit is contained in:
@@ -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