Menu Close Menu
Menu
  • Themes
  • Extensions
  • Showcase
  • Support
    • Documentation
    • Open Support Ticket
    • Terms & Conditions
  • Blog
  • Account
    • Number of items in cart: 0

      • Your cart is empty.
      • Subtotal: $0.00
      • Estimated Tax: $0.00
      • Total: $0.00
      • Checkout

Adding A Preset Sport

Adding A Preset Sport

You can add your own preset sports by hooking into the wpcm_sports action. The following is an example which needs to be added to your themes functions.php.

function custom_add_new_sport( $sport ) {
	$sport['cricket'] = array(
		'name' => __( 'Cricket', 'your-theme' ),
		'terms' => array(
			'wpcm_position' => array(
				array(
					'name' => 'Wicket Keeper',
					'slug' => 'wicket-keeper',
				),
			)	
		),
		'stats_labels' => array(
			'runs' => array(
				'name' => __( 'Runs', 'your-theme' ),
				'label' => _x( 'RUNS', 'Runs', 'your-theme' ),
			),
			'wickets' => array(
				'name' => __( 'Wickets', 'your-theme' ),
				'label' => _x( 'WKTS', 'Wickets', 'your-theme' ),
			),
			'rating' => array(
				'name' => __( 'Rating', 'your-theme' ),
				'label' => _x( 'RAT', 'Rating', 'your-theme' ),

			),
			'mvp' => array(
				'name' => __( 'Player of Match', 'your-theme' ),
				'label' => _x( 'POM', 'Player of Match', 'your-theme' ),
			)
		),
		'standings_columns' => array(
			'p' => array(
				'name' => __( 'Played', your-theme' ),
				'label' => _x( 'P', 'Played', 'your-theme' ),
			),
			'w' => array(
				'name' => __( 'Won', 'your-theme' ),
				'label' => _x( 'W', 'Won', 'your-theme' ),
			),
			'd' => array(
				'name' => __( 'Draw', 'your-theme' ),
				'label' => _x( 'D', 'Draw', 'your-theme' ),
			),
			'l' => array(
				'name' => __( 'Lost', 'your-theme' ),
				'label' => _x( 'L', 'Lost', 'your-theme' ),
			),
			'f' => array(
				'name' => __( 'Goals For', 'your-theme' ),
				'label' => _x( 'F', 'Goals For', 'your-theme' ),
			),
			'a' => array(
				'name' => __( 'Goals Against', 'your-theme' ),
				'label' => _x( 'A', 'Played', 'your-theme' ),
			),
			'gd' => array(
				'name' => __( 'Goal Difference', 'your-theme' ),
				'label' => _x( 'GD', 'Goal Difference', 'your-theme' ),
			),
			'pts' => array(
				'name' => __( 'Points', 'your-theme' ),
				'label' => _x( 'Pts', 'Points', 'your-theme' ),
			)
		)
	);
	return $sport;
}
add_filter( 'wpcm_sports', 'custom_add_new_sport', 10, 1 );
4th October 2020

Post navigation

Previous

Introduction to Hooks: Actions & Filters

Next

How To Disable Default Styles

Docs Categories

  • Clubs (4)
  • Getting Started (4)
  • League Tables & Rosters (3)
  • Matches (6)
  • Players & Staff (9)
  • Plugin Settings (11)
  • Shortcodes (8)
  • Snippets (4)
  • Theming & Extending (3)
  • Widgets (6)

Popular Articles

  • Third Party Theme Compatibility
  • Match List Shortcode
  • Managing Clubs
  • League Table Shortcode
  • Quick Start Guide
  • Extensions
  • Themes
  • Showcase
  • Terms
  • Documentation
  • Support
  • Support Policy
  • Blog
© 2014-20 WP Club Manager | Manage your sports club website