diff --git a/admin/post-types/column.php b/admin/post-types/column.php index 4e003d89..9cc8fb34 100644 --- a/admin/post-types/column.php +++ b/admin/post-types/column.php @@ -8,8 +8,6 @@ function sp_column_cpt_init() { 'label' => $name, 'labels' => $labels, 'public' => false, - 'show_ui' => true, - 'show_in_nav_menus' => false, 'hierarchical' => false, 'supports' => array( 'title', 'page-attributes' ), 'register_meta_box_cb' => 'sp_column_meta_init', diff --git a/admin/post-types/list.php b/admin/post-types/list.php index b8da587e..d3728caf 100644 --- a/admin/post-types/list.php +++ b/admin/post-types/list.php @@ -52,7 +52,8 @@ function sp_list_player_meta( $post ) { 'show_option_none' => sprintf( __( 'Select %s', 'sportspress' ), __( 'League', 'sportspress' ) ), 'taxonomy' => 'sp_league', 'name' => 'sp_league', - 'selected' => $league_id + 'selected' => $league_id, + 'value' => 'term_id' ); sp_dropdown_taxonomies( $args ); ?> diff --git a/admin/post-types/outcome.php b/admin/post-types/outcome.php index 8f2c778f..8dc10848 100644 --- a/admin/post-types/outcome.php +++ b/admin/post-types/outcome.php @@ -8,8 +8,6 @@ function sp_outcome_cpt_init() { 'label' => $name, 'labels' => $labels, 'public' => false, - 'show_ui' => true, - 'show_in_nav_menus' => false, 'hierarchical' => false, 'supports' => array( 'title', 'page-attributes' ), 'show_in_menu' => 'edit.php?post_type=sp_event', diff --git a/admin/post-types/result.php b/admin/post-types/result.php index cfe61ec0..9a53b061 100644 --- a/admin/post-types/result.php +++ b/admin/post-types/result.php @@ -8,8 +8,6 @@ function sp_result_cpt_init() { 'label' => $name, 'labels' => $labels, 'public' => false, - 'show_ui' => true, - 'show_in_nav_menus' => false, 'hierarchical' => false, 'supports' => array( 'title', 'page-attributes' ), 'show_in_menu' => 'edit.php?post_type=sp_event', diff --git a/admin/post-types/separator.php b/admin/post-types/separator.php new file mode 100644 index 00000000..c7cbe739 --- /dev/null +++ b/admin/post-types/separator.php @@ -0,0 +1,11 @@ + false, + 'show_ui' => true, + 'show_in_nav_menus' => false, + ); + register_post_type( 'sp_separator', $args ); +} +add_action( 'init', 'sp_separator_cpt_init' ); +?> \ No newline at end of file diff --git a/admin/post-types/staff.php b/admin/post-types/staff.php index 98db5870..60d3939b 100644 --- a/admin/post-types/staff.php +++ b/admin/post-types/staff.php @@ -12,7 +12,7 @@ function sp_staff_cpt_init() { 'supports' => array( 'title', 'author', 'thumbnail' ), 'register_meta_box_cb' => 'sp_staff_meta_init', 'rewrite' => array( 'slug' => get_option( 'sp_staff_slug', 'staff' ) ), - 'capability_type' => array( 'sp_staff', 'sp_staff' ) + 'capability_type' => 'sp_staff' ); register_post_type( 'sp_staff', $args ); } diff --git a/admin/post-types/statistic.php b/admin/post-types/statistic.php index 5bf8c791..feb3edfd 100644 --- a/admin/post-types/statistic.php +++ b/admin/post-types/statistic.php @@ -8,8 +8,6 @@ function sp_statistic_cpt_init() { 'label' => $name, 'labels' => $labels, 'public' => false, - 'show_ui' => true, - 'show_in_nav_menus' => false, 'hierarchical' => false, 'supports' => array( 'title', 'page-attributes' ), 'register_meta_box_cb' => 'sp_statistic_meta_init', diff --git a/admin/post-types/table.php b/admin/post-types/table.php index cc3dc124..bea407e6 100644 --- a/admin/post-types/table.php +++ b/admin/post-types/table.php @@ -13,7 +13,7 @@ function sp_table_cpt_init() { 'register_meta_box_cb' => 'sp_table_meta_init', 'rewrite' => array( 'slug' => 'table' ), 'show_in_menu' => 'edit.php?post_type=sp_team', - 'capability_type' => 'sp_table' +// 'capability_type' => 'sp_table' ); register_post_type( 'sp_table', $args ); } @@ -50,7 +50,8 @@ function sp_table_team_meta( $post, $test ) { 'show_option_none' => sprintf( __( 'Select %s', 'sportspress' ), __( 'League', 'sportspress' ) ), 'taxonomy' => 'sp_league', 'name' => 'sp_league', - 'selected' => $league_id + 'selected' => $league_id, + 'value' => 'term_id' ); sp_dropdown_taxonomies( $args ); ?> diff --git a/classes/shortcodes/table.php b/classes/shortcodes/table.php deleted file mode 100644 index cf347e49..00000000 --- a/classes/shortcodes/table.php +++ /dev/null @@ -1,63 +0,0 @@ - 0, - 'div' => 0 - ), $atts ) ); - - // Get all teams in the league - $args = array( - 'post_type' => 'sp_team', - 'numberposts' => -1, - 'posts_per_page' => -1, - 'tax_query' => array() - ); - if ( $div ) { - $args['tax_query'][] = array( - 'taxonomy' => 'sp_league', - 'terms' => $div, - 'field' => 'term_id' - ); - } - $teams = get_posts( $args ); - - // Check if there are any teams - $size = sizeof( $teams ); - if ( $size == 0 ) - return false; - - // Generate table - $output = ' - - - '; - foreach( $stats as $stat ) { - $output .= ''; - } - $output .= - ' - - '; - // insert rows - $rownum = 0; - foreach ( $teams as $club ) { - $rownum ++; - $club_stats = $club->tb_stats; - $output .= - ''; - $output .= ''; - foreach( $stats as $stat ) { - $output .= ''; - } - } - $output.= - ' -
' . __( 'Position', 'sportspress' ) . '' . $sp_table_stats_labels[$stat] . '
' . $club->place . ' ' . ( $club_links ? '' : '' ) . get_the_post_thumbnail( $club->ID, 'crest-small', array( 'title' => $club->post_title, 'class' => 'crest' ) ) . ' ' . $club->post_title . ( $club_links ? '' : '' ) . '' . $club_stats[$stat] . '
'; - if ( isset( $linkpage ) ) - $output .= '' . $linktext . ''; - $output .= ''; - return $output; -} -?> \ No newline at end of file diff --git a/lib/classes/README.md b/lib/eos/README.md similarity index 100% rename from lib/classes/README.md rename to lib/eos/README.md diff --git a/lib/classes/eos.class.php b/lib/eos/eos.class.php similarity index 100% rename from lib/classes/eos.class.php rename to lib/eos/eos.class.php diff --git a/lib/classes/stack.class.php b/lib/eos/stack.class.php similarity index 100% rename from lib/classes/stack.class.php rename to lib/eos/stack.class.php diff --git a/presets/baseball.php b/presets/baseball.php new file mode 100644 index 00000000..7f29582a --- /dev/null +++ b/presets/baseball.php @@ -0,0 +1,109 @@ + __( 'Baseball', 'sportspress' ), + 'posts' => array( + // Statistics + 'sp_statistic' => array( + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Assists', 'sportspress' ), + 'post_name' => 'assists', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Yellow Cards', 'sportspress' ), + 'post_name' => 'yellowcards', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Red Cards', 'sportspress' ), + 'post_name' => 'redcards', + 'meta' => array( 'sp_equation' => '' ) + ) + ), + // Outcomes + 'sp_outcome' => array( + array( + 'post_title' => __( 'Win', 'sportspress' ), + 'post_name' => 'win' + ), + array( + 'post_title' => __( 'Draw', 'sportspress' ), + 'post_name' => 'draw' + ), + array( + 'post_title' => __( 'Loss', 'sportspress' ), + 'post_name' => 'loss' + ) + ), + // Results + 'sp_result' => array( + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals' + ), + array( + 'post_title' => __( '1st Half', 'sportspress' ), + 'post_name' => 'firsthalf' + ), + array( + 'post_title' => __( '2nd Half', 'sportspress' ), + 'post_name' => 'secondhalf' + ) + ), + // Columns + 'sp_column' => array( + array( + 'post_title' => __( 'P', 'sportspress' ), + 'post_name' => 'p', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'W', 'sportspress' ), + 'post_name' => 'w', + 'meta' => array( 'sp_equation' => '$win' ) + ), + array( + 'post_title' => __( 'D', 'sportspress' ), + 'post_name' => 'd', + 'meta' => array( 'sp_equation' => '$draw' ) + ), + array( + 'post_title' => __( 'L', 'sportspress' ), + 'post_name' => 'l', + 'meta' => array( 'sp_equation' => '$loss' ) + ), + array( + 'post_title' => __( 'F', 'sportspress' ), + 'post_name' => 'f', + 'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'A', 'sportspress' ), + 'post_name' => 'a', + 'meta' => array( 'sp_equation' => '$goalsagainst' ) + ), + array( + 'post_title' => __( 'GD', 'sportspress' ), + 'post_name' => 'gd', + 'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'PTS', 'sportspress' ), + 'post_name' => 'pts', + 'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' ) + ) + ) + ) +); \ No newline at end of file diff --git a/presets/basketball.php b/presets/basketball.php new file mode 100644 index 00000000..678538bb --- /dev/null +++ b/presets/basketball.php @@ -0,0 +1,109 @@ + __( 'Basketball', 'sportspress' ), + 'posts' => array( + // Statistics + 'sp_statistic' => array( + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Assists', 'sportspress' ), + 'post_name' => 'assists', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Yellow Cards', 'sportspress' ), + 'post_name' => 'yellowcards', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Red Cards', 'sportspress' ), + 'post_name' => 'redcards', + 'meta' => array( 'sp_equation' => '' ) + ) + ), + // Outcomes + 'sp_outcome' => array( + array( + 'post_title' => __( 'Win', 'sportspress' ), + 'post_name' => 'win' + ), + array( + 'post_title' => __( 'Draw', 'sportspress' ), + 'post_name' => 'draw' + ), + array( + 'post_title' => __( 'Loss', 'sportspress' ), + 'post_name' => 'loss' + ) + ), + // Results + 'sp_result' => array( + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals' + ), + array( + 'post_title' => __( '1st Half', 'sportspress' ), + 'post_name' => 'firsthalf' + ), + array( + 'post_title' => __( '2nd Half', 'sportspress' ), + 'post_name' => 'secondhalf' + ) + ), + // Columns + 'sp_column' => array( + array( + 'post_title' => __( 'P', 'sportspress' ), + 'post_name' => 'p', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'W', 'sportspress' ), + 'post_name' => 'w', + 'meta' => array( 'sp_equation' => '$win' ) + ), + array( + 'post_title' => __( 'D', 'sportspress' ), + 'post_name' => 'd', + 'meta' => array( 'sp_equation' => '$draw' ) + ), + array( + 'post_title' => __( 'L', 'sportspress' ), + 'post_name' => 'l', + 'meta' => array( 'sp_equation' => '$loss' ) + ), + array( + 'post_title' => __( 'F', 'sportspress' ), + 'post_name' => 'f', + 'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'A', 'sportspress' ), + 'post_name' => 'a', + 'meta' => array( 'sp_equation' => '$goalsagainst' ) + ), + array( + 'post_title' => __( 'GD', 'sportspress' ), + 'post_name' => 'gd', + 'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'PTS', 'sportspress' ), + 'post_name' => 'pts', + 'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' ) + ) + ) + ) +); \ No newline at end of file diff --git a/presets/cricket.php b/presets/cricket.php new file mode 100644 index 00000000..20ae1b95 --- /dev/null +++ b/presets/cricket.php @@ -0,0 +1,109 @@ + __( 'Cricket', 'sportspress' ), + 'posts' => array( + // Statistics + 'sp_statistic' => array( + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Assists', 'sportspress' ), + 'post_name' => 'assists', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Yellow Cards', 'sportspress' ), + 'post_name' => 'yellowcards', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Red Cards', 'sportspress' ), + 'post_name' => 'redcards', + 'meta' => array( 'sp_equation' => '' ) + ) + ), + // Outcomes + 'sp_outcome' => array( + array( + 'post_title' => __( 'Win', 'sportspress' ), + 'post_name' => 'win' + ), + array( + 'post_title' => __( 'Draw', 'sportspress' ), + 'post_name' => 'draw' + ), + array( + 'post_title' => __( 'Loss', 'sportspress' ), + 'post_name' => 'loss' + ) + ), + // Results + 'sp_result' => array( + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals' + ), + array( + 'post_title' => __( '1st Half', 'sportspress' ), + 'post_name' => 'firsthalf' + ), + array( + 'post_title' => __( '2nd Half', 'sportspress' ), + 'post_name' => 'secondhalf' + ) + ), + // Columns + 'sp_column' => array( + array( + 'post_title' => __( 'P', 'sportspress' ), + 'post_name' => 'p', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'W', 'sportspress' ), + 'post_name' => 'w', + 'meta' => array( 'sp_equation' => '$win' ) + ), + array( + 'post_title' => __( 'D', 'sportspress' ), + 'post_name' => 'd', + 'meta' => array( 'sp_equation' => '$draw' ) + ), + array( + 'post_title' => __( 'L', 'sportspress' ), + 'post_name' => 'l', + 'meta' => array( 'sp_equation' => '$loss' ) + ), + array( + 'post_title' => __( 'F', 'sportspress' ), + 'post_name' => 'f', + 'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'A', 'sportspress' ), + 'post_name' => 'a', + 'meta' => array( 'sp_equation' => '$goalsagainst' ) + ), + array( + 'post_title' => __( 'GD', 'sportspress' ), + 'post_name' => 'gd', + 'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'PTS', 'sportspress' ), + 'post_name' => 'pts', + 'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' ) + ) + ) + ) +); \ No newline at end of file diff --git a/presets/football.php b/presets/football.php new file mode 100644 index 00000000..f4327e67 --- /dev/null +++ b/presets/football.php @@ -0,0 +1,104 @@ + __( 'American Football', 'sportspress' ), + 'posts' => array( + // Statistics + 'sp_statistic' => array( + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Assists', 'sportspress' ), + 'post_name' => 'assists', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Yellow Cards', 'sportspress' ), + 'post_name' => 'yellowcards', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Red Cards', 'sportspress' ), + 'post_name' => 'redcards', + 'meta' => array( 'sp_equation' => '' ) + ) + ), + // Outcomes + 'sp_outcome' => array( + array( + 'post_title' => __( 'Win', 'sportspress' ), + 'post_name' => 'win' + ), + array( + 'post_title' => __( 'Draw', 'sportspress' ), + 'post_name' => 'draw' + ), + array( + 'post_title' => __( 'Loss', 'sportspress' ), + 'post_name' => 'loss' + ) + ), + // Results + 'sp_result' => array( + array( + 'post_title' => __( 'Touchdowns', 'sportspress' ), + 'post_name' => 'touchdowns' + ), + array( + 'post_title' => __( '1st Half', 'sportspress' ), + 'post_name' => 'firsthalf' + ), + array( + 'post_title' => __( '2nd Half', 'sportspress' ), + 'post_name' => 'secondhalf' + ) + ), + // Columns + 'sp_column' => array( + array( + 'post_title' => __( 'W', 'sportspress' ), + 'post_name' => 'w', + 'meta' => array( 'sp_equation' => '$win' ) + ), + array( + 'post_title' => __( 'L', 'sportspress' ), + 'post_name' => 'l', + 'meta' => array( 'sp_equation' => '$loss' ) + ), + array( + 'post_title' => __( 'T', 'sportspress' ), + 'post_name' => 'd', + 'meta' => array( 'sp_equation' => '$draw' ) + ), + array( + 'post_title' => __( 'PCT', 'sportspress' ), + 'post_name' => 'pct', + 'meta' => array( 'sp_equation' => '$win / $eventsplayed', 'sp_priority' => '1', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'PF', 'sportspress' ), + 'post_name' => 'pf', + 'meta' => array( 'sp_equation' => '$pointsfor', 'sp_priority' => '2', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'PA', 'sportspress' ), + 'post_name' => 'pa', + 'meta' => array( 'sp_equation' => '$pointsagainst' ) + ), + array( + 'post_title' => __( 'STRK', 'sportspress' ), + 'post_name' => 'strk', + 'meta' => array( 'sp_equation' => '$streak' ) + ) + ) + ) +); \ No newline at end of file diff --git a/presets/footy.php b/presets/footy.php new file mode 100644 index 00000000..2407d698 --- /dev/null +++ b/presets/footy.php @@ -0,0 +1,109 @@ + __( 'Australian Rules Football', 'sportspress' ), + 'posts' => array( + // Statistics + 'sp_statistic' => array( + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Assists', 'sportspress' ), + 'post_name' => 'assists', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Yellow Cards', 'sportspress' ), + 'post_name' => 'yellowcards', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Red Cards', 'sportspress' ), + 'post_name' => 'redcards', + 'meta' => array( 'sp_equation' => '' ) + ) + ), + // Outcomes + 'sp_outcome' => array( + array( + 'post_title' => __( 'Win', 'sportspress' ), + 'post_name' => 'win' + ), + array( + 'post_title' => __( 'Draw', 'sportspress' ), + 'post_name' => 'draw' + ), + array( + 'post_title' => __( 'Loss', 'sportspress' ), + 'post_name' => 'loss' + ) + ), + // Results + 'sp_result' => array( + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals' + ), + array( + 'post_title' => __( '1st Half', 'sportspress' ), + 'post_name' => 'firsthalf' + ), + array( + 'post_title' => __( '2nd Half', 'sportspress' ), + 'post_name' => 'secondhalf' + ) + ), + // Columns + 'sp_column' => array( + array( + 'post_title' => __( 'P', 'sportspress' ), + 'post_name' => 'p', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'W', 'sportspress' ), + 'post_name' => 'w', + 'meta' => array( 'sp_equation' => '$win' ) + ), + array( + 'post_title' => __( 'D', 'sportspress' ), + 'post_name' => 'd', + 'meta' => array( 'sp_equation' => '$draw' ) + ), + array( + 'post_title' => __( 'L', 'sportspress' ), + 'post_name' => 'l', + 'meta' => array( 'sp_equation' => '$loss' ) + ), + array( + 'post_title' => __( 'F', 'sportspress' ), + 'post_name' => 'f', + 'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'A', 'sportspress' ), + 'post_name' => 'a', + 'meta' => array( 'sp_equation' => '$goalsagainst' ) + ), + array( + 'post_title' => __( 'GD', 'sportspress' ), + 'post_name' => 'gd', + 'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'PTS', 'sportspress' ), + 'post_name' => 'pts', + 'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' ) + ) + ) + ) +); \ No newline at end of file diff --git a/presets/gaming.php b/presets/gaming.php new file mode 100644 index 00000000..ff934274 --- /dev/null +++ b/presets/gaming.php @@ -0,0 +1,109 @@ + __( 'Competitive Gaming', 'sportspress' ), + 'posts' => array( + // Statistics + 'sp_statistic' => array( + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Assists', 'sportspress' ), + 'post_name' => 'assists', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Yellow Cards', 'sportspress' ), + 'post_name' => 'yellowcards', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Red Cards', 'sportspress' ), + 'post_name' => 'redcards', + 'meta' => array( 'sp_equation' => '' ) + ) + ), + // Outcomes + 'sp_outcome' => array( + array( + 'post_title' => __( 'Win', 'sportspress' ), + 'post_name' => 'win' + ), + array( + 'post_title' => __( 'Draw', 'sportspress' ), + 'post_name' => 'draw' + ), + array( + 'post_title' => __( 'Loss', 'sportspress' ), + 'post_name' => 'loss' + ) + ), + // Results + 'sp_result' => array( + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals' + ), + array( + 'post_title' => __( '1st Half', 'sportspress' ), + 'post_name' => 'firsthalf' + ), + array( + 'post_title' => __( '2nd Half', 'sportspress' ), + 'post_name' => 'secondhalf' + ) + ), + // Columns + 'sp_column' => array( + array( + 'post_title' => __( 'P', 'sportspress' ), + 'post_name' => 'p', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'W', 'sportspress' ), + 'post_name' => 'w', + 'meta' => array( 'sp_equation' => '$win' ) + ), + array( + 'post_title' => __( 'D', 'sportspress' ), + 'post_name' => 'd', + 'meta' => array( 'sp_equation' => '$draw' ) + ), + array( + 'post_title' => __( 'L', 'sportspress' ), + 'post_name' => 'l', + 'meta' => array( 'sp_equation' => '$loss' ) + ), + array( + 'post_title' => __( 'F', 'sportspress' ), + 'post_name' => 'f', + 'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'A', 'sportspress' ), + 'post_name' => 'a', + 'meta' => array( 'sp_equation' => '$goalsagainst' ) + ), + array( + 'post_title' => __( 'GD', 'sportspress' ), + 'post_name' => 'gd', + 'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'PTS', 'sportspress' ), + 'post_name' => 'pts', + 'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' ) + ) + ) + ) +); \ No newline at end of file diff --git a/presets/golf.php b/presets/golf.php new file mode 100644 index 00000000..1a3d964a --- /dev/null +++ b/presets/golf.php @@ -0,0 +1,109 @@ + __( 'Golf', 'sportspress' ), + 'posts' => array( + // Statistics + 'sp_statistic' => array( + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Assists', 'sportspress' ), + 'post_name' => 'assists', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Yellow Cards', 'sportspress' ), + 'post_name' => 'yellowcards', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Red Cards', 'sportspress' ), + 'post_name' => 'redcards', + 'meta' => array( 'sp_equation' => '' ) + ) + ), + // Outcomes + 'sp_outcome' => array( + array( + 'post_title' => __( 'Win', 'sportspress' ), + 'post_name' => 'win' + ), + array( + 'post_title' => __( 'Draw', 'sportspress' ), + 'post_name' => 'draw' + ), + array( + 'post_title' => __( 'Loss', 'sportspress' ), + 'post_name' => 'loss' + ) + ), + // Results + 'sp_result' => array( + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals' + ), + array( + 'post_title' => __( '1st Half', 'sportspress' ), + 'post_name' => 'firsthalf' + ), + array( + 'post_title' => __( '2nd Half', 'sportspress' ), + 'post_name' => 'secondhalf' + ) + ), + // Columns + 'sp_column' => array( + array( + 'post_title' => __( 'P', 'sportspress' ), + 'post_name' => 'p', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'W', 'sportspress' ), + 'post_name' => 'w', + 'meta' => array( 'sp_equation' => '$win' ) + ), + array( + 'post_title' => __( 'D', 'sportspress' ), + 'post_name' => 'd', + 'meta' => array( 'sp_equation' => '$draw' ) + ), + array( + 'post_title' => __( 'L', 'sportspress' ), + 'post_name' => 'l', + 'meta' => array( 'sp_equation' => '$loss' ) + ), + array( + 'post_title' => __( 'F', 'sportspress' ), + 'post_name' => 'f', + 'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'A', 'sportspress' ), + 'post_name' => 'a', + 'meta' => array( 'sp_equation' => '$goalsagainst' ) + ), + array( + 'post_title' => __( 'GD', 'sportspress' ), + 'post_name' => 'gd', + 'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'PTS', 'sportspress' ), + 'post_name' => 'pts', + 'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' ) + ) + ) + ) +); \ No newline at end of file diff --git a/presets/handball.php b/presets/handball.php new file mode 100644 index 00000000..44867f2f --- /dev/null +++ b/presets/handball.php @@ -0,0 +1,109 @@ + __( 'Handball', 'sportspress' ), + 'posts' => array( + // Statistics + 'sp_statistic' => array( + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Assists', 'sportspress' ), + 'post_name' => 'assists', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Yellow Cards', 'sportspress' ), + 'post_name' => 'yellowcards', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Red Cards', 'sportspress' ), + 'post_name' => 'redcards', + 'meta' => array( 'sp_equation' => '' ) + ) + ), + // Outcomes + 'sp_outcome' => array( + array( + 'post_title' => __( 'Win', 'sportspress' ), + 'post_name' => 'win' + ), + array( + 'post_title' => __( 'Draw', 'sportspress' ), + 'post_name' => 'draw' + ), + array( + 'post_title' => __( 'Loss', 'sportspress' ), + 'post_name' => 'loss' + ) + ), + // Results + 'sp_result' => array( + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals' + ), + array( + 'post_title' => __( '1st Half', 'sportspress' ), + 'post_name' => 'firsthalf' + ), + array( + 'post_title' => __( '2nd Half', 'sportspress' ), + 'post_name' => 'secondhalf' + ) + ), + // Columns + 'sp_column' => array( + array( + 'post_title' => __( 'P', 'sportspress' ), + 'post_name' => 'p', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'W', 'sportspress' ), + 'post_name' => 'w', + 'meta' => array( 'sp_equation' => '$win' ) + ), + array( + 'post_title' => __( 'D', 'sportspress' ), + 'post_name' => 'd', + 'meta' => array( 'sp_equation' => '$draw' ) + ), + array( + 'post_title' => __( 'L', 'sportspress' ), + 'post_name' => 'l', + 'meta' => array( 'sp_equation' => '$loss' ) + ), + array( + 'post_title' => __( 'F', 'sportspress' ), + 'post_name' => 'f', + 'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'A', 'sportspress' ), + 'post_name' => 'a', + 'meta' => array( 'sp_equation' => '$goalsagainst' ) + ), + array( + 'post_title' => __( 'GD', 'sportspress' ), + 'post_name' => 'gd', + 'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'PTS', 'sportspress' ), + 'post_name' => 'pts', + 'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' ) + ) + ) + ) +); \ No newline at end of file diff --git a/presets/hockey.php b/presets/hockey.php new file mode 100644 index 00000000..5767cba4 --- /dev/null +++ b/presets/hockey.php @@ -0,0 +1,109 @@ + __( 'Hockey', 'sportspress' ), + 'posts' => array( + // Statistics + 'sp_statistic' => array( + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Assists', 'sportspress' ), + 'post_name' => 'assists', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Yellow Cards', 'sportspress' ), + 'post_name' => 'yellowcards', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Red Cards', 'sportspress' ), + 'post_name' => 'redcards', + 'meta' => array( 'sp_equation' => '' ) + ) + ), + // Outcomes + 'sp_outcome' => array( + array( + 'post_title' => __( 'Win', 'sportspress' ), + 'post_name' => 'win' + ), + array( + 'post_title' => __( 'Draw', 'sportspress' ), + 'post_name' => 'draw' + ), + array( + 'post_title' => __( 'Loss', 'sportspress' ), + 'post_name' => 'loss' + ) + ), + // Results + 'sp_result' => array( + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals' + ), + array( + 'post_title' => __( '1st Half', 'sportspress' ), + 'post_name' => 'firsthalf' + ), + array( + 'post_title' => __( '2nd Half', 'sportspress' ), + 'post_name' => 'secondhalf' + ) + ), + // Columns + 'sp_column' => array( + array( + 'post_title' => __( 'P', 'sportspress' ), + 'post_name' => 'p', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'W', 'sportspress' ), + 'post_name' => 'w', + 'meta' => array( 'sp_equation' => '$win' ) + ), + array( + 'post_title' => __( 'D', 'sportspress' ), + 'post_name' => 'd', + 'meta' => array( 'sp_equation' => '$draw' ) + ), + array( + 'post_title' => __( 'L', 'sportspress' ), + 'post_name' => 'l', + 'meta' => array( 'sp_equation' => '$loss' ) + ), + array( + 'post_title' => __( 'F', 'sportspress' ), + 'post_name' => 'f', + 'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'A', 'sportspress' ), + 'post_name' => 'a', + 'meta' => array( 'sp_equation' => '$goalsagainst' ) + ), + array( + 'post_title' => __( 'GD', 'sportspress' ), + 'post_name' => 'gd', + 'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'PTS', 'sportspress' ), + 'post_name' => 'pts', + 'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' ) + ) + ) + ) +); \ No newline at end of file diff --git a/presets/racing.php b/presets/racing.php new file mode 100644 index 00000000..a99d1f9a --- /dev/null +++ b/presets/racing.php @@ -0,0 +1,109 @@ + __( 'Racing', 'sportspress' ), + 'posts' => array( + // Statistics + 'sp_statistic' => array( + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Assists', 'sportspress' ), + 'post_name' => 'assists', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Yellow Cards', 'sportspress' ), + 'post_name' => 'yellowcards', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Red Cards', 'sportspress' ), + 'post_name' => 'redcards', + 'meta' => array( 'sp_equation' => '' ) + ) + ), + // Outcomes + 'sp_outcome' => array( + array( + 'post_title' => __( 'Win', 'sportspress' ), + 'post_name' => 'win' + ), + array( + 'post_title' => __( 'Draw', 'sportspress' ), + 'post_name' => 'draw' + ), + array( + 'post_title' => __( 'Loss', 'sportspress' ), + 'post_name' => 'loss' + ) + ), + // Results + 'sp_result' => array( + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals' + ), + array( + 'post_title' => __( '1st Half', 'sportspress' ), + 'post_name' => 'firsthalf' + ), + array( + 'post_title' => __( '2nd Half', 'sportspress' ), + 'post_name' => 'secondhalf' + ) + ), + // Columns + 'sp_column' => array( + array( + 'post_title' => __( 'P', 'sportspress' ), + 'post_name' => 'p', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'W', 'sportspress' ), + 'post_name' => 'w', + 'meta' => array( 'sp_equation' => '$win' ) + ), + array( + 'post_title' => __( 'D', 'sportspress' ), + 'post_name' => 'd', + 'meta' => array( 'sp_equation' => '$draw' ) + ), + array( + 'post_title' => __( 'L', 'sportspress' ), + 'post_name' => 'l', + 'meta' => array( 'sp_equation' => '$loss' ) + ), + array( + 'post_title' => __( 'F', 'sportspress' ), + 'post_name' => 'f', + 'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'A', 'sportspress' ), + 'post_name' => 'a', + 'meta' => array( 'sp_equation' => '$goalsagainst' ) + ), + array( + 'post_title' => __( 'GD', 'sportspress' ), + 'post_name' => 'gd', + 'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'PTS', 'sportspress' ), + 'post_name' => 'pts', + 'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' ) + ) + ) + ) +); \ No newline at end of file diff --git a/presets/rugby.php b/presets/rugby.php new file mode 100644 index 00000000..f5530bbe --- /dev/null +++ b/presets/rugby.php @@ -0,0 +1,109 @@ + __( 'Rugby', 'sportspress' ), + 'posts' => array( + // Statistics + 'sp_statistic' => array( + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Assists', 'sportspress' ), + 'post_name' => 'assists', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Yellow Cards', 'sportspress' ), + 'post_name' => 'yellowcards', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Red Cards', 'sportspress' ), + 'post_name' => 'redcards', + 'meta' => array( 'sp_equation' => '' ) + ) + ), + // Outcomes + 'sp_outcome' => array( + array( + 'post_title' => __( 'Win', 'sportspress' ), + 'post_name' => 'win' + ), + array( + 'post_title' => __( 'Draw', 'sportspress' ), + 'post_name' => 'draw' + ), + array( + 'post_title' => __( 'Loss', 'sportspress' ), + 'post_name' => 'loss' + ) + ), + // Results + 'sp_result' => array( + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals' + ), + array( + 'post_title' => __( '1st Half', 'sportspress' ), + 'post_name' => 'firsthalf' + ), + array( + 'post_title' => __( '2nd Half', 'sportspress' ), + 'post_name' => 'secondhalf' + ) + ), + // Columns + 'sp_column' => array( + array( + 'post_title' => __( 'P', 'sportspress' ), + 'post_name' => 'p', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'W', 'sportspress' ), + 'post_name' => 'w', + 'meta' => array( 'sp_equation' => '$win' ) + ), + array( + 'post_title' => __( 'D', 'sportspress' ), + 'post_name' => 'd', + 'meta' => array( 'sp_equation' => '$draw' ) + ), + array( + 'post_title' => __( 'L', 'sportspress' ), + 'post_name' => 'l', + 'meta' => array( 'sp_equation' => '$loss' ) + ), + array( + 'post_title' => __( 'F', 'sportspress' ), + 'post_name' => 'f', + 'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'A', 'sportspress' ), + 'post_name' => 'a', + 'meta' => array( 'sp_equation' => '$goalsagainst' ) + ), + array( + 'post_title' => __( 'GD', 'sportspress' ), + 'post_name' => 'gd', + 'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'PTS', 'sportspress' ), + 'post_name' => 'pts', + 'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' ) + ) + ) + ) +); \ No newline at end of file diff --git a/presets/soccer.php b/presets/soccer.php new file mode 100644 index 00000000..81cbbb6e --- /dev/null +++ b/presets/soccer.php @@ -0,0 +1,109 @@ + __( 'Soccer', 'sportspress' ), + 'posts' => array( + // Statistics + 'sp_statistic' => array( + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Assists', 'sportspress' ), + 'post_name' => 'assists', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Yellow Cards', 'sportspress' ), + 'post_name' => 'yellowcards', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Red Cards', 'sportspress' ), + 'post_name' => 'redcards', + 'meta' => array( 'sp_equation' => '' ) + ) + ), + // Outcomes + 'sp_outcome' => array( + array( + 'post_title' => __( 'Win', 'sportspress' ), + 'post_name' => 'win' + ), + array( + 'post_title' => __( 'Draw', 'sportspress' ), + 'post_name' => 'draw' + ), + array( + 'post_title' => __( 'Loss', 'sportspress' ), + 'post_name' => 'loss' + ) + ), + // Results + 'sp_result' => array( + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals' + ), + array( + 'post_title' => __( '1st Half', 'sportspress' ), + 'post_name' => 'firsthalf' + ), + array( + 'post_title' => __( '2nd Half', 'sportspress' ), + 'post_name' => 'secondhalf' + ) + ), + // Columns + 'sp_column' => array( + array( + 'post_title' => __( 'P', 'sportspress' ), + 'post_name' => 'p', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'W', 'sportspress' ), + 'post_name' => 'w', + 'meta' => array( 'sp_equation' => '$win' ) + ), + array( + 'post_title' => __( 'D', 'sportspress' ), + 'post_name' => 'd', + 'meta' => array( 'sp_equation' => '$draw' ) + ), + array( + 'post_title' => __( 'L', 'sportspress' ), + 'post_name' => 'l', + 'meta' => array( 'sp_equation' => '$loss' ) + ), + array( + 'post_title' => __( 'F', 'sportspress' ), + 'post_name' => 'f', + 'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'A', 'sportspress' ), + 'post_name' => 'a', + 'meta' => array( 'sp_equation' => '$goalsagainst' ) + ), + array( + 'post_title' => __( 'GD', 'sportspress' ), + 'post_name' => 'gd', + 'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'PTS', 'sportspress' ), + 'post_name' => 'pts', + 'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' ) + ) + ) + ) +); \ No newline at end of file diff --git a/presets/swimming.php b/presets/swimming.php new file mode 100644 index 00000000..9f8de4ef --- /dev/null +++ b/presets/swimming.php @@ -0,0 +1,109 @@ + __( 'Swimming', 'sportspress' ), + 'posts' => array( + // Statistics + 'sp_statistic' => array( + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Assists', 'sportspress' ), + 'post_name' => 'assists', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Yellow Cards', 'sportspress' ), + 'post_name' => 'yellowcards', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Red Cards', 'sportspress' ), + 'post_name' => 'redcards', + 'meta' => array( 'sp_equation' => '' ) + ) + ), + // Outcomes + 'sp_outcome' => array( + array( + 'post_title' => __( 'Win', 'sportspress' ), + 'post_name' => 'win' + ), + array( + 'post_title' => __( 'Draw', 'sportspress' ), + 'post_name' => 'draw' + ), + array( + 'post_title' => __( 'Loss', 'sportspress' ), + 'post_name' => 'loss' + ) + ), + // Results + 'sp_result' => array( + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals' + ), + array( + 'post_title' => __( '1st Half', 'sportspress' ), + 'post_name' => 'firsthalf' + ), + array( + 'post_title' => __( '2nd Half', 'sportspress' ), + 'post_name' => 'secondhalf' + ) + ), + // Columns + 'sp_column' => array( + array( + 'post_title' => __( 'P', 'sportspress' ), + 'post_name' => 'p', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'W', 'sportspress' ), + 'post_name' => 'w', + 'meta' => array( 'sp_equation' => '$win' ) + ), + array( + 'post_title' => __( 'D', 'sportspress' ), + 'post_name' => 'd', + 'meta' => array( 'sp_equation' => '$draw' ) + ), + array( + 'post_title' => __( 'L', 'sportspress' ), + 'post_name' => 'l', + 'meta' => array( 'sp_equation' => '$loss' ) + ), + array( + 'post_title' => __( 'F', 'sportspress' ), + 'post_name' => 'f', + 'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'A', 'sportspress' ), + 'post_name' => 'a', + 'meta' => array( 'sp_equation' => '$goalsagainst' ) + ), + array( + 'post_title' => __( 'GD', 'sportspress' ), + 'post_name' => 'gd', + 'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'PTS', 'sportspress' ), + 'post_name' => 'pts', + 'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' ) + ) + ) + ) +); \ No newline at end of file diff --git a/presets/tennis.php b/presets/tennis.php new file mode 100644 index 00000000..8cb1b44a --- /dev/null +++ b/presets/tennis.php @@ -0,0 +1,109 @@ + __( 'Tennis', 'sportspress' ), + 'posts' => array( + // Statistics + 'sp_statistic' => array( + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Assists', 'sportspress' ), + 'post_name' => 'assists', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Yellow Cards', 'sportspress' ), + 'post_name' => 'yellowcards', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Red Cards', 'sportspress' ), + 'post_name' => 'redcards', + 'meta' => array( 'sp_equation' => '' ) + ) + ), + // Outcomes + 'sp_outcome' => array( + array( + 'post_title' => __( 'Win', 'sportspress' ), + 'post_name' => 'win' + ), + array( + 'post_title' => __( 'Draw', 'sportspress' ), + 'post_name' => 'draw' + ), + array( + 'post_title' => __( 'Loss', 'sportspress' ), + 'post_name' => 'loss' + ) + ), + // Results + 'sp_result' => array( + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals' + ), + array( + 'post_title' => __( '1st Half', 'sportspress' ), + 'post_name' => 'firsthalf' + ), + array( + 'post_title' => __( '2nd Half', 'sportspress' ), + 'post_name' => 'secondhalf' + ) + ), + // Columns + 'sp_column' => array( + array( + 'post_title' => __( 'P', 'sportspress' ), + 'post_name' => 'p', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'W', 'sportspress' ), + 'post_name' => 'w', + 'meta' => array( 'sp_equation' => '$win' ) + ), + array( + 'post_title' => __( 'D', 'sportspress' ), + 'post_name' => 'd', + 'meta' => array( 'sp_equation' => '$draw' ) + ), + array( + 'post_title' => __( 'L', 'sportspress' ), + 'post_name' => 'l', + 'meta' => array( 'sp_equation' => '$loss' ) + ), + array( + 'post_title' => __( 'F', 'sportspress' ), + 'post_name' => 'f', + 'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'A', 'sportspress' ), + 'post_name' => 'a', + 'meta' => array( 'sp_equation' => '$goalsagainst' ) + ), + array( + 'post_title' => __( 'GD', 'sportspress' ), + 'post_name' => 'gd', + 'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'PTS', 'sportspress' ), + 'post_name' => 'pts', + 'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' ) + ) + ) + ) +); \ No newline at end of file diff --git a/presets/volleyball.php b/presets/volleyball.php new file mode 100644 index 00000000..3a112c46 --- /dev/null +++ b/presets/volleyball.php @@ -0,0 +1,109 @@ + __( 'Volleyball', 'sportspress' ), + 'posts' => array( + // Statistics + 'sp_statistic' => array( + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Assists', 'sportspress' ), + 'post_name' => 'assists', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Yellow Cards', 'sportspress' ), + 'post_name' => 'yellowcards', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Red Cards', 'sportspress' ), + 'post_name' => 'redcards', + 'meta' => array( 'sp_equation' => '' ) + ) + ), + // Outcomes + 'sp_outcome' => array( + array( + 'post_title' => __( 'Win', 'sportspress' ), + 'post_name' => 'win' + ), + array( + 'post_title' => __( 'Draw', 'sportspress' ), + 'post_name' => 'draw' + ), + array( + 'post_title' => __( 'Loss', 'sportspress' ), + 'post_name' => 'loss' + ) + ), + // Results + 'sp_result' => array( + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals' + ), + array( + 'post_title' => __( '1st Half', 'sportspress' ), + 'post_name' => 'firsthalf' + ), + array( + 'post_title' => __( '2nd Half', 'sportspress' ), + 'post_name' => 'secondhalf' + ) + ), + // Columns + 'sp_column' => array( + array( + 'post_title' => __( 'P', 'sportspress' ), + 'post_name' => 'p', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'W', 'sportspress' ), + 'post_name' => 'w', + 'meta' => array( 'sp_equation' => '$win' ) + ), + array( + 'post_title' => __( 'D', 'sportspress' ), + 'post_name' => 'd', + 'meta' => array( 'sp_equation' => '$draw' ) + ), + array( + 'post_title' => __( 'L', 'sportspress' ), + 'post_name' => 'l', + 'meta' => array( 'sp_equation' => '$loss' ) + ), + array( + 'post_title' => __( 'F', 'sportspress' ), + 'post_name' => 'f', + 'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'A', 'sportspress' ), + 'post_name' => 'a', + 'meta' => array( 'sp_equation' => '$goalsagainst' ) + ), + array( + 'post_title' => __( 'GD', 'sportspress' ), + 'post_name' => 'gd', + 'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'PTS', 'sportspress' ), + 'post_name' => 'pts', + 'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' ) + ) + ) + ) +); \ No newline at end of file diff --git a/sports.php b/sports.php new file mode 100644 index 00000000..6dd8bfa6 --- /dev/null +++ b/sports.php @@ -0,0 +1,111 @@ + array( + 'name' => __( 'Soccer', 'sportspress' ), + 'posts' => array( + // Statistics + 'sp_statistic' => array( + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Assists', 'sportspress' ), + 'post_name' => 'assists', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Yellow Cards', 'sportspress' ), + 'post_name' => 'yellowcards', + 'meta' => array( 'sp_equation' => '' ) + ), + array( + 'post_title' => __( 'Red Cards', 'sportspress' ), + 'post_name' => 'redcards', + 'meta' => array( 'sp_equation' => '' ) + ) + ), + // Outcomes + 'sp_outcome' => array( + array( + 'post_title' => __( 'Win', 'sportspress' ), + 'post_name' => 'win' + ), + array( + 'post_title' => __( 'Draw', 'sportspress' ), + 'post_name' => 'draw' + ), + array( + 'post_title' => __( 'Loss', 'sportspress' ), + 'post_name' => 'loss' + ) + ), + // Results + 'sp_result' => array( + array( + 'post_title' => __( 'Goals', 'sportspress' ), + 'post_name' => 'goals' + ), + array( + 'post_title' => __( '1st Half', 'sportspress' ), + 'post_name' => 'firsthalf' + ), + array( + 'post_title' => __( '2nd Half', 'sportspress' ), + 'post_name' => 'secondhalf' + ) + ), + // Columns + 'sp_column' => array( + array( + 'post_title' => __( 'P', 'sportspress' ), + 'post_name' => 'p', + 'meta' => array( 'sp_equation' => '$eventsplayed' ) + ), + array( + 'post_title' => __( 'W', 'sportspress' ), + 'post_name' => 'w', + 'meta' => array( 'sp_equation' => '$win' ) + ), + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$draw' ) + ), + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$loss' ) + ), + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$goalsagainst' ) + ), + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' ) + ), + array( + 'post_title' => __( 'Appearances', 'sportspress' ), + 'post_name' => 'appearances', + 'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' ) + ) + ) + + ) + ) +); +?> \ No newline at end of file diff --git a/sportspress-actions.php b/sportspress-actions.php index 319a92f6..2bcc08e9 100644 --- a/sportspress-actions.php +++ b/sportspress-actions.php @@ -10,12 +10,26 @@ function sp_after_theme_setup() { } add_action( 'after_theme_setup', 'sp_after_theme_setup' ); -function sp_admin_menu() { +function sp_admin_menu( $position ) { if ( ! current_user_can( 'manage_options' ) ) return; global $menu, $submenu; - + + // Find where our placeholder is in the menu + foreach( $menu as $key => $data ) { + if ( is_array( $data ) && array_key_exists( 2, $data ) && $data[2] == 'edit.php?post_type=sp_separator' ) + $position = $key; + } + + // Swap our placeholder post type with a menu separator + if ( $position ): + $menu[ $position ] = array( '', 'read', 'separator-sportspress', '', 'wp-menu-separator sportspress' ); + endif; + + // Remove "Add Configuration" link under SportsPress + unset( $submenu['edit.php?post_type=sp_config'][10] ); + // Remove "Leagues" link under Events unset( $submenu['edit.php?post_type=sp_event'][15] ); diff --git a/sportspress-defaults.php b/sportspress-defaults.php index 8583f9cc..bee6a5cb 100644 --- a/sportspress-defaults.php +++ b/sportspress-defaults.php @@ -7,6 +7,7 @@ if ( !function_exists( 'sportspress_install' ) ) { $role = get_role( 'administrator' ); // Events + $role->add_cap( 'edit_sp_event' ); $role->add_cap( 'edit_sp_events' ); $role->add_cap( 'edit_others_sp_events' ); $role->add_cap( 'delete_sp_events' ); @@ -15,14 +16,16 @@ if ( !function_exists( 'sportspress_install' ) ) { $role->add_cap( 'read_private_sp_events' ); // Teams - $role->add_cap( 'edit_sp_staff' ); - $role->add_cap( 'edit_others_sp_staff' ); - $role->add_cap( 'delete_sp_staff' ); - $role->add_cap( 'publish_sp_staff' ); - $role->add_cap( 'read_sp_staff' ); - $role->add_cap( 'read_private_sp_staff' ); + $role->add_cap( 'edit_sp_team' ); + $role->add_cap( 'edit_sp_teams' ); + $role->add_cap( 'edit_others_sp_teams' ); + $role->add_cap( 'delete_sp_teams' ); + $role->add_cap( 'publish_sp_teams' ); + $role->add_cap( 'read_sp_teams' ); + $role->add_cap( 'read_private_sp_teams' ); // League Tables + $role->add_cap( 'edit_sp_table' ); $role->add_cap( 'edit_sp_tables' ); $role->add_cap( 'edit_others_sp_tables' ); $role->add_cap( 'delete_sp_tables' ); @@ -31,6 +34,7 @@ if ( !function_exists( 'sportspress_install' ) ) { $role->add_cap( 'read_private_sp_tables' ); // Players + $role->add_cap( 'edit_sp_player' ); $role->add_cap( 'edit_sp_players' ); $role->add_cap( 'edit_others_sp_players' ); $role->add_cap( 'delete_sp_players' ); @@ -39,6 +43,7 @@ if ( !function_exists( 'sportspress_install' ) ) { $role->add_cap( 'read_private_sp_players' ); // Player Lists + $role->add_cap( 'edit_sp_list' ); $role->add_cap( 'edit_sp_lists' ); $role->add_cap( 'edit_others_sp_lists' ); $role->add_cap( 'delete_sp_lists' ); @@ -48,19 +53,21 @@ if ( !function_exists( 'sportspress_install' ) ) { // Staff $role->add_cap( 'edit_sp_staff' ); - $role->add_cap( 'edit_others_sp_staff' ); - $role->add_cap( 'delete_sp_staff' ); - $role->add_cap( 'publish_sp_staff' ); - $role->add_cap( 'read_sp_staff' ); - $role->add_cap( 'read_private_sp_staff' ); + $role->add_cap( 'edit_sp_staffs' ); + $role->add_cap( 'edit_others_sp_staffs' ); + $role->add_cap( 'delete_sp_staffs' ); + $role->add_cap( 'publish_sp_staffs' ); + $role->add_cap( 'read_sp_staffs' ); + $role->add_cap( 'read_private_sp_staffs' ); // Settings - $role->add_cap( 'edit_sp_settings' ); - $role->add_cap( 'edit_others_sp_settings' ); - $role->add_cap( 'delete_sp_settings' ); - $role->add_cap( 'publish_sp_settings' ); - $role->add_cap( 'read_sp_settings' ); - $role->add_cap( 'read_private_sp_settings' ); + $role->add_cap( 'edit_sp_config' ); + $role->add_cap( 'edit_sp_configs' ); + $role->add_cap( 'edit_others_sp_configs' ); + $role->add_cap( 'delete_sp_configs' ); + $role->add_cap( 'publish_sp_configs' ); + $role->add_cap( 'read_sp_configs' ); + $role->add_cap( 'read_private_sp_configs' ); // Team Manager remove_role( 'sp_team_manager' ); @@ -134,7 +141,7 @@ if ( !function_exists( 'sportspress_install' ) ) { array( 'post_title' => 'F', 'post_name' => 'f', 'post_status' => 'publish', 'post_type' => 'sp_column', 'meta' => array( 'sp_equation' => '$goalsfor', 'sp_priority' => '3', 'sp_order' => 'DESC' ) ), array( 'post_title' => 'A', 'post_name' => 'a', 'post_status' => 'publish', 'post_type' => 'sp_column', 'meta' => array( 'sp_equation' => '$goalsagainst' ) ), array( 'post_title' => 'GD', 'post_name' => 'gd', 'post_status' => 'publish', 'post_type' => 'sp_column', 'meta' => array( 'sp_equation' => '$goalsfor - $goalsagainst', 'sp_priority' => '2', 'sp_order' => 'DESC' ) ), - array( 'post_title' => 'PTS', 'post_name' => 'pts', 'post_status' => 'publish', 'post_type' => 'sp_column', 'meta' => array( 'sp_equation' => '$win x 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' ) ), + array( 'post_title' => 'PTS', 'post_name' => 'pts', 'post_status' => 'publish', 'post_type' => 'sp_column', 'meta' => array( 'sp_equation' => '$win * 3 + $draw', 'sp_priority' => '1', 'sp_order' => 'DESC' ) ), // Statistics array( 'post_title' => 'Appearances', 'post_name' => 'appearances', 'post_status' => 'publish', 'post_type' => 'sp_statistic', 'meta' => array( 'sp_equation' => '$eventsplayed' ) ), diff --git a/sportspress-functions.php b/sportspress-functions.php index 8c1d46b1..b38a1e69 100644 --- a/sportspress-functions.php +++ b/sportspress-functions.php @@ -108,7 +108,8 @@ if ( !function_exists( 'sp_dropdown_taxonomies' ) ) { 'show_option_none' => false, 'taxonomy' => null, 'name' => null, - 'selected' => null + 'selected' => null, + 'value' => 'slug' ); $args = array_merge( $defaults, $args ); $terms = get_terms( $args['taxonomy'] ); @@ -122,7 +123,10 @@ if ( !function_exists( 'sp_dropdown_taxonomies' ) ) { printf( '', $args['show_option_none'] ); } foreach ( $terms as $term ) { - printf( '', $term->term_id, selected( true, $args['selected'] == $term->term_id, false ), $term->name ); + if ( $args['value'] == 'term_id' ) + printf( '', $term->term_id, selected( true, $args['selected'] == $term->term_id, false ), $term->name ); + else + printf( '', $term->slug, selected( true, $args['selected'] == $term->slug, false ), $term->name ); } print( '' ); } diff --git a/sportspress-globals.php b/sportspress-globals.php index bdc5a675..f787eef3 100644 --- a/sportspress-globals.php +++ b/sportspress-globals.php @@ -1,4 +1,21 @@ array( 'Enter title here' => __( 'Team', 'sportspress' ), @@ -50,20 +67,4 @@ $sportspress_thumbnail_texts = array( 'Remove featured image' => sprintf( __( 'Remove %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ) ) ); - -$sportspress_options = array( - 'settings' => array( - 'sp_event_team_count' => 2, - 'sp_team_stats_columns' => '', - 'sp_event_stats_columns' => '', - 'sp_player_stats_columns' => '' - ) -); - -foreach( $sportspress_options as $optiongroupkey => $optiongroup ) { - foreach( $optiongroup as $key => $value ) { - //if ( get_option( $key ) === false ) - update_option( $key, $value ); - } -} ?> \ No newline at end of file diff --git a/sportspress-hooks.php b/sportspress-hooks.php index d6929d8e..1837f2d4 100644 --- a/sportspress-hooks.php +++ b/sportspress-hooks.php @@ -1,6 +1,7 @@
-
+

-
@@ -32,91 +31,82 @@ function sportspress_settings() { __( 'P', 'sportspress' ) . ': $appearances' . "\r\n" . - __( 'W', 'sportspress' ) . ': $greater' . "\r\n" . - __( 'D', 'sportspress' ) . ': $equal' . "\r\n" . - __( 'L', 'sportspress' ) . ': $less' . "\r\n" . - __( 'F', 'sportspress' ) . ': $for' . "\r\n" . - __( 'A', 'sportspress' ) . ': $against' . "\r\n" . - __( 'GD', 'sportspress' ) . ': $for - $against' . "\r\n" . - __( 'PTS', 'sportspress' ) . ': 3 * $greater + $equal', + if ( sp_array_value( $original, 'sport', null ) != sp_array_value( $input, 'sport', null ) ): - 'event' => __( 'Goals', 'sportspress' ) . ': $goals' . "\r\n" . - __( '1st Half', 'sportspress' ) . ': $firsthalf' . "\r\n" . - __( '2nd Half', 'sportspress' ) . ': $secondhalf', + global $sportspress_sports; - 'player' => __( 'Goals', 'sportspress' ) . ': $goals' . "\r\n" . - __( 'Assists', 'sportspress' ) . ': $assists' . "\r\n" . - __( 'Yellow Cards', 'sportspress' ) . ': $yellowcards' . "\r\n" . - __( 'Red Cards', 'sportspress' ) . ': $redcards' + $post_groups = sp_array_value( sp_array_value( $sportspress_sports, sp_array_value( $input, 'sport', null ), array() ), 'posts', array() ); - ); - - return apply_filters( 'sportspress_default_stats', $defaults ); - + foreach( $post_groups as $post_type => $posts ): + + // Delete posts + $old_posts = get_posts( array( 'post_type' => $post_type, 'numberposts' => -1, 'posts_per_page' => -1 ) ); + foreach( $old_posts as $post ): + wp_delete_post( $post->ID, true); + endforeach; + + // Add posts + foreach( $posts as $index => $post ): + $post['post_type'] = $post_type; + if ( ! get_page_by_path( $post['post_name'], OBJECT, $post['post_type'] ) ): + $post['menu_order'] = $index; + $post['post_status'] = 'publish'; + $id = wp_insert_post( $post ); + if ( array_key_exists( 'meta', $post ) ): + foreach ( $post['meta'] as $key => $value ): + update_post_meta( $id, $key, $value ); + endforeach; + endif; + endif; + endforeach; + + endforeach; + + endif; + + return $input; } -function sportspress_intialize_stats() { - - if( false == get_option( 'sportspress_stats' ) ) { - add_option( 'sportspress_stats', apply_filters( 'sportspress_default_stats', sportspress_default_stats() ) ); - } +function sportspress_register_settings() { + + register_setting( + 'sportspress', + 'sportspress', + 'sportspress_validate' + ); add_settings_section( - 'sportspress_stats', + 'general', '', '', - 'sportspress_stats' + 'sportspress' ); add_settings_field( 'sport', __( 'Sport', 'sportspress' ), 'sportspress_sport_callback', - 'sportspress_stats', - 'sportspress_stats' - ); - - /* - add_settings_field( - 'team', - __( 'Teams', 'sportspress' ), - 'sportspress_team_stats_callback', - 'sportspress_stats', - 'sportspress_stats' - ); - - add_settings_field( - 'event', - __( 'Events', 'sportspress' ), - 'sportspress_event_stats_callback', - 'sportspress_stats', - 'sportspress_stats' - ); - - add_settings_field( - 'player', - __( 'Players', 'sportspress' ), - 'sportspress_player_stats_callback', - 'sportspress_stats', - 'sportspress_stats' - ); - */ - - register_setting( - 'sportspress_stats', - 'sportspress_stats' + 'sportspress', + 'general' ); } -add_action( 'admin_init', 'sportspress_intialize_stats' ); +add_action( 'admin_init', 'sportspress_register_settings' ); function sportspress_sport_callback() { - sportspress_render_option_field( 'sportspress_stats', 'sport', 'sport' ); + global $sportspress_sports; + $options = get_option( 'sportspress' ); + ?> + +