Enable limiting teams in events
This commit is contained in:
@@ -22,15 +22,14 @@ class SP_Meta_Box_Event_Teams {
|
||||
$teams = (array)get_post_meta( $post->ID, 'sp_team', false );
|
||||
foreach ( $teams as $key => $value ):
|
||||
?>
|
||||
<div class="sp-clone">
|
||||
<div class="sp-instance">
|
||||
<p class="sp-tab-select sp-title-generator">
|
||||
<?php
|
||||
$args = array(
|
||||
'post_type' => 'sp_team',
|
||||
'name' => 'sp_team[]',
|
||||
'class' => 'sportspress-pages',
|
||||
'show_option_none' => sprintf( __( 'Remove', 'sportspress' ), 'Team' ),
|
||||
'option_none_value' => '0',
|
||||
'show_option_none' => sprintf( __( '— None —', 'sportspress' ), 'Team' ),
|
||||
'selected' => $value
|
||||
);
|
||||
wp_dropdown_pages( $args );
|
||||
@@ -45,28 +44,14 @@ class SP_Meta_Box_Event_Teams {
|
||||
sp_post_checklist( $post->ID, 'sp_staff', 'none', 'sp_current_team', $key );
|
||||
?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div class="sp-clone" data-clone-name="sp_team">
|
||||
<p class="sp-tab-select sp-title-generator">
|
||||
<?php
|
||||
$args = array(
|
||||
'post_type' => 'sp_team',
|
||||
'name' => 'sp_team_selector',
|
||||
'class' => 'sportspress-pages',
|
||||
'show_option_none' => __( '— Add —', 'sportspress' ),
|
||||
'option_none_value' => '0'
|
||||
);
|
||||
wp_dropdown_pages( $args );
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
<?php endforeach;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save meta box data
|
||||
*/
|
||||
public static function save( $post_id, $post ) {
|
||||
sp_update_post_meta( $post_id, 'sp_limit', sp_array_value( $_POST, 'sp_limit', 2 ) );
|
||||
sp_update_post_meta_recursive( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', array() ) );
|
||||
sp_update_post_meta_recursive( $post_id, 'sp_player', sp_array_value( $_POST, 'sp_player', array() ) );
|
||||
sp_update_post_meta_recursive( $post_id, 'sp_staff', sp_array_value( $_POST, 'sp_staff', array() ) );
|
||||
|
||||
@@ -41,6 +41,19 @@ class SP_Settings_Events extends SP_Settings_Page {
|
||||
|
||||
array( 'title' => __( 'Event Options', 'sportspress' ), 'type' => 'title','desc' => '', 'id' => 'event_options' ),
|
||||
|
||||
array(
|
||||
'title' => __( 'Limit', 'sportspress' ),
|
||||
'id' => 'sportspress_event_teams',
|
||||
'class' => 'small-text',
|
||||
'default' => '2',
|
||||
'desc' => __( 'teams', 'sportspress' ),
|
||||
'type' => 'number',
|
||||
'custom_attributes' => array(
|
||||
'min' => 1,
|
||||
'step' => 1
|
||||
),
|
||||
),
|
||||
|
||||
array( 'type' => 'delimiter' ),
|
||||
|
||||
array(
|
||||
@@ -125,7 +138,9 @@ class SP_Settings_Events extends SP_Settings_Page {
|
||||
*/
|
||||
public function delimiter_setting() {
|
||||
$selection = get_option( 'sportspress_event_teams_delimiter', 'vs' );
|
||||
|
||||
$limit = get_option( 'sportspress_event_teams', 2 );
|
||||
$example = str_repeat( __( 'Team', 'sportspress' ) . ' %1$s ', $limit );
|
||||
$example = rtrim( $example, ' %1$s ' );
|
||||
?>
|
||||
<tr valign="top">
|
||||
<th scope="row" class="titledesc">
|
||||
@@ -136,10 +151,10 @@ class SP_Settings_Events extends SP_Settings_Page {
|
||||
<legend class="screen-reader-text"><span><?php _e( 'Delimiter', 'sportspress' ); ?></span></legend>
|
||||
<?php $delimiters = array( 'vs', 'v', '—', '/' ); ?>
|
||||
<?php foreach ( $delimiters as $delimiter ): ?>
|
||||
<label title="<?php echo $delimiter; ?>"><input type="radio" class="preset" name="sportspress_event_teams_delimiter_preset" value="<?php echo $delimiter; ?>" data-example="<?php _e( 'Team', 'sportspress' ); ?> <?php echo $delimiter; ?> <?php _e( 'Team', 'sportspress' ); ?>" <?php checked( $delimiter, $selection ); ?>> <span><?php _e( 'Team', 'sportspress' ); ?> <?php echo $delimiter; ?> <?php _e( 'Team', 'sportspress' ); ?></span></label><br>
|
||||
<label title="<?php echo $delimiter; ?>"><input type="radio" class="preset" name="sportspress_event_teams_delimiter_preset" value="<?php echo $delimiter; ?>" data-example="<?php printf( $example, $delimiter ); ?>" <?php checked( $delimiter, $selection ); ?>> <span><?php printf( $example, $delimiter ); ?></span></label><br>
|
||||
<?php endforeach; ?>
|
||||
<label><input type="radio" class="preset" name="sportspress_event_teams_delimiter_preset" value="\c\u\s\t\o\m" <?php checked( false, in_array( $selection, $delimiters ) ); ?>> <?php _e( 'Custom:', 'sportspress' ); ?> </label><input type="text" class="small-text value" name="sportspress_event_teams_delimiter" value="<?php echo $selection; ?>" data-example-format="<?php _e( 'Team', 'sportspress' ); ?> __val__ <?php _e( 'Team', 'sportspress' ); ?>">
|
||||
<span class="example"><?php _e( 'Team', 'sportspress' ); ?> <?php echo $selection; ?> <?php _e( 'Team', 'sportspress' ); ?></span>
|
||||
<label><input type="radio" class="preset" name="sportspress_event_teams_delimiter_preset" value="\c\u\s\t\o\m" <?php checked( false, in_array( $selection, $delimiters ) ); ?>> <?php _e( 'Custom:', 'sportspress' ); ?> </label><input type="text" class="small-text value" name="sportspress_event_teams_delimiter" value="<?php echo $selection; ?>" data-example-format="<?php printf( $example, '__val__' ); ?>">
|
||||
<span class="example"><?php printf( $example, $selection ); ?></span>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
103
readme.txt
103
readme.txt
@@ -1,6 +1,5 @@
|
||||
=== SportsPress - sports league management ===
|
||||
=== SportsPress ===
|
||||
Contributors: ThemeBoy
|
||||
Tags: sports, press, sports journalism, teams, team management, fixtures, results, standings, league tables, leagues, reporting, themeboy, wordpress sports, configurable
|
||||
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=support@themeboy.com&item_name=Donation+for+SportsPress
|
||||
Requires at least: 3.8
|
||||
Tested up to: 3.9
|
||||
@@ -16,41 +15,6 @@ Created by the developers at [ThemeBoy](http://themeboy.com/) and featured on So
|
||||
|
||||
Add schedules, results, league tables, player profiles and statistics to your team or league site with SportsPress. It uses core WordPress markup syntax and will integrate seamlessly with most themes. Custom shortcodes, CSV importers, and several language translations are included.
|
||||
|
||||
= Features =
|
||||
* Team Profiles
|
||||
* League Tables
|
||||
* Events (Fixtures & Results)
|
||||
* Events Calendar
|
||||
* Player Profiles & Statistics Per Position
|
||||
* Player Lists
|
||||
* Staff Profiles
|
||||
* Season Archives
|
||||
* Venue Information & Maps
|
||||
* Statistics & League Table Columns Configuration
|
||||
* Import Events, Teams, and Players from CSV Files
|
||||
|
||||
= Customizable =
|
||||
|
||||
League table columns, player statistics, and match results can be customized to fit any sport. Presets are available for some of the most popular sports including soccer, rugby, American football, Australian Rules football, baseball, basketball, cricket, and hockey.
|
||||
|
||||
= Available Languages =
|
||||
* English – English ( en_US )
|
||||
* Arabic – العربية ( ar )
|
||||
* Croatian – Hrvatski ( hr )
|
||||
* Czech – Čeština ( cs_CZ )
|
||||
* French – Français ( fr_FR )
|
||||
* German – Deutsch ( de_DE )
|
||||
* Greek – Ελληνικά ( el_GR )
|
||||
* Italian – Italiano ( it_IT )
|
||||
* Japanese – 日本語 ( ja )
|
||||
* Polish – Polski ( pl_PL )
|
||||
* Portuguese (Brazil) – Português do Brasil ( pt_BR )
|
||||
* Russian - Русский ( ru_RU )
|
||||
* Slovak – Slovenčina ( sk_SK )
|
||||
* Slovenian – Slovenija ( sl_SI )
|
||||
* Spanish – Español ( es_ES )
|
||||
* Swedish – Svenska ( sv_SE )
|
||||
|
||||
= Get involved =
|
||||
|
||||
Developers can contribute via the [SportsPress GitHub Repository](https://github.com/ThemeBoy/SportsPress/blob/master/CONTRIBUTING.md).
|
||||
@@ -87,60 +51,6 @@ Automatic updates should work like a charm; as always though, ensure you backup
|
||||
|
||||
If on the off-chance you do encounter issues with the event/team/player/staff pages after an update you simply need to flush the permalinks by going to WordPress > Settings > Permalinks and hitting 'save'. That should return things to normal.
|
||||
|
||||
= Sport Presets =
|
||||
|
||||
SportsPress comes with settings for some sports that you can apply by going to WordPress > Settings > SportsPress. By selecting a sport, presets will be applied to Events, League Tables, and Players.
|
||||
|
||||
= Results =
|
||||
|
||||
Main Result is the default result that will be displayed in the admin list when an event has been played.
|
||||
|
||||
Results are the values that you want to keep track of and display on your event pages. In Association Football, for example, typical results are "1st half", "2nd half", and "Goals". For Baseball, you would have 9+ "Innings", "Hits", "Runs", and "Errors".
|
||||
|
||||
To add a new result, go to Settings > SportsPress > Results > Add New. Enter a name that you would like to be displayed in the column.
|
||||
|
||||
The "Key" is the variable name used in league table calculations and will be automatically generated when you create a new result, but you can also change this. The Order Attribute is the order that your result will be displayed among your other results.
|
||||
|
||||
= Outcomes =
|
||||
|
||||
Outcomes are very similar to results but you can only have one outcome per team per event. An outcome determines the ultimate result (win, draw, loss, etc.) of an event. Examples of outcomes are: W, D, L, and OT.
|
||||
|
||||
= Columns =
|
||||
|
||||
Manage the columns you would like to calculate and display in league tables.
|
||||
|
||||
Create a Title that you want to use as the column label, the Key will automatically be generated but you do have the option to change it here.
|
||||
|
||||
You can define an equation for a column by selecting the options from the dropdown menu. As an example, a “Wins” column should just be “W” from the dropdown. For more complex calculations, you'll need to select multiple elements to create your equations. For example, the equation for Pts in Association Football would be W x 3 + D.
|
||||
|
||||
"Events Played" accounts for the number of events that have an outcome selected. If an outcome has not been selected for an event, it will not be counted towards this number. For example if you played a friendly match and do not want to include the points towards your league table, do not select an outcome.
|
||||
|
||||
Results are tracked for each team. When you create equations, the left arrow (←) represents “for” and the right arrow (→) represents “against.” For example, Goals → represents “Goals For.”
|
||||
|
||||
"Rounding" is the number of decimal points you want to round to at the end of a calculation.
|
||||
Example: if the equation is "W ÷ Events Played" where W = 2 and Events Played = 3, setting "Rounding" to 3 will output "1.667" and rounding to 1 will output "1.7". Rounding is set to 0 by default, which returns a whole number (integer), in this case, "2".
|
||||
|
||||
Sort Order is for the way you want to sort your League Table. You can create and specify multiple sort orders. The first dropdown is the priority, and the second dropdown is the direction. If you want a secondary column, in the event of a tie, set another column to sort with priority "2".
|
||||
|
||||
As an example, in Association Football, Pts would be 1 descending, and GD would be 2 descending. This means that the leading team is the team with the most points, then the highest goal difference (GD).
|
||||
|
||||
= Metrics =
|
||||
|
||||
Metrics are static values associated with players, and are useful for variables like height, weight, hobbies, etc. that will be displayed on player profile pages. When you create a new metric, remember to select the position(s) that the metric applies to or it will not show up in player profiles. Metrics are independent of leagues, seasons, and teams.
|
||||
|
||||
= Performance =
|
||||
|
||||
Performance is for keeping track of the performance variables like goals, assists, yellow cards, and red cards. They are displayed on player profile pages, event pages, and player lists. Each player will have their own set of statistics for each event and league per season. You can choose whether to calculate the total or average of each variable by selecting from the “Calculate” dropdown menu. Be sure to select the position(s) that each statistic applies to so it shows up on the appropriate players' profile pages.
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. SportsPress style settings, configuration, and responsive layout example.
|
||||
2. League Table in Twenty Fourteen theme with default color scheme.
|
||||
3. Events List in Twenty Fourteen theme with default color scheme.
|
||||
4. Events Calendar in Twenty Fourteen theme with default color scheme.
|
||||
5. Player List in Twenty Fourteen theme with default color scheme.
|
||||
6. Player Gallery in Twenty Fourteen theme with default color scheme.
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= Which sports does this plugin support? =
|
||||
@@ -155,16 +65,17 @@ Yes; SportsPress will work with any theme, but may require some styling to make
|
||||
|
||||
Bugs can be reported either in our support forum or preferably on the [SportsPress GitHub repository](https://github.com/ThemeBoy/SportsPress/issues).
|
||||
|
||||
= Is this plugin ready for production? =
|
||||
= Is this plugin ready for my site? =
|
||||
|
||||
SportsPress is currently in beta and is undergoing testing. We are still actively making adjustments to the code, so we do not recommend using it until we officially leave the beta phase.
|
||||
|
||||
= Can I import teams/players/events from a CSV file? =
|
||||
|
||||
Yes, CSV importers are included with the plugin. Go to Tools > Import and choose from one of the SportsPress CSV importers. When importing events, be sure to use the date format yyyy/mm/dd.
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 0.8.3 =
|
||||
* Feature - Enable using events started and substituted in statistics equations.
|
||||
* Tweak - Remove deprecated MySQL version function from System Status page.
|
||||
* Fix - Adjust styling to display select boxes in admin.
|
||||
|
||||
= 0.8.2 =
|
||||
* Fix - Add content in main loop only.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user