Add settings and presets

This commit is contained in:
ThemeBoy
2013-12-28 05:37:41 +11:00
parent 03f0ce2893
commit 51bf14e85d
35 changed files with 1882 additions and 184 deletions

View File

@@ -8,8 +8,6 @@ function sp_column_cpt_init() {
'label' => $name, 'label' => $name,
'labels' => $labels, 'labels' => $labels,
'public' => false, 'public' => false,
'show_ui' => true,
'show_in_nav_menus' => false,
'hierarchical' => false, 'hierarchical' => false,
'supports' => array( 'title', 'page-attributes' ), 'supports' => array( 'title', 'page-attributes' ),
'register_meta_box_cb' => 'sp_column_meta_init', 'register_meta_box_cb' => 'sp_column_meta_init',

View File

@@ -52,7 +52,8 @@ function sp_list_player_meta( $post ) {
'show_option_none' => sprintf( __( 'Select %s', 'sportspress' ), __( 'League', 'sportspress' ) ), 'show_option_none' => sprintf( __( 'Select %s', 'sportspress' ), __( 'League', 'sportspress' ) ),
'taxonomy' => 'sp_league', 'taxonomy' => 'sp_league',
'name' => 'sp_league', 'name' => 'sp_league',
'selected' => $league_id 'selected' => $league_id,
'value' => 'term_id'
); );
sp_dropdown_taxonomies( $args ); sp_dropdown_taxonomies( $args );
?> ?>

View File

@@ -8,8 +8,6 @@ function sp_outcome_cpt_init() {
'label' => $name, 'label' => $name,
'labels' => $labels, 'labels' => $labels,
'public' => false, 'public' => false,
'show_ui' => true,
'show_in_nav_menus' => false,
'hierarchical' => false, 'hierarchical' => false,
'supports' => array( 'title', 'page-attributes' ), 'supports' => array( 'title', 'page-attributes' ),
'show_in_menu' => 'edit.php?post_type=sp_event', 'show_in_menu' => 'edit.php?post_type=sp_event',

View File

@@ -8,8 +8,6 @@ function sp_result_cpt_init() {
'label' => $name, 'label' => $name,
'labels' => $labels, 'labels' => $labels,
'public' => false, 'public' => false,
'show_ui' => true,
'show_in_nav_menus' => false,
'hierarchical' => false, 'hierarchical' => false,
'supports' => array( 'title', 'page-attributes' ), 'supports' => array( 'title', 'page-attributes' ),
'show_in_menu' => 'edit.php?post_type=sp_event', 'show_in_menu' => 'edit.php?post_type=sp_event',

View File

@@ -0,0 +1,11 @@
<?php
function sp_separator_cpt_init() {
$args = array(
'public' => false,
'show_ui' => true,
'show_in_nav_menus' => false,
);
register_post_type( 'sp_separator', $args );
}
add_action( 'init', 'sp_separator_cpt_init' );
?>

View File

@@ -12,7 +12,7 @@ function sp_staff_cpt_init() {
'supports' => array( 'title', 'author', 'thumbnail' ), 'supports' => array( 'title', 'author', 'thumbnail' ),
'register_meta_box_cb' => 'sp_staff_meta_init', 'register_meta_box_cb' => 'sp_staff_meta_init',
'rewrite' => array( 'slug' => get_option( 'sp_staff_slug', 'staff' ) ), '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 ); register_post_type( 'sp_staff', $args );
} }

View File

@@ -8,8 +8,6 @@ function sp_statistic_cpt_init() {
'label' => $name, 'label' => $name,
'labels' => $labels, 'labels' => $labels,
'public' => false, 'public' => false,
'show_ui' => true,
'show_in_nav_menus' => false,
'hierarchical' => false, 'hierarchical' => false,
'supports' => array( 'title', 'page-attributes' ), 'supports' => array( 'title', 'page-attributes' ),
'register_meta_box_cb' => 'sp_statistic_meta_init', 'register_meta_box_cb' => 'sp_statistic_meta_init',

View File

@@ -13,7 +13,7 @@ function sp_table_cpt_init() {
'register_meta_box_cb' => 'sp_table_meta_init', 'register_meta_box_cb' => 'sp_table_meta_init',
'rewrite' => array( 'slug' => 'table' ), 'rewrite' => array( 'slug' => 'table' ),
'show_in_menu' => 'edit.php?post_type=sp_team', 'show_in_menu' => 'edit.php?post_type=sp_team',
'capability_type' => 'sp_table' // 'capability_type' => 'sp_table'
); );
register_post_type( 'sp_table', $args ); 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' ) ), 'show_option_none' => sprintf( __( 'Select %s', 'sportspress' ), __( 'League', 'sportspress' ) ),
'taxonomy' => 'sp_league', 'taxonomy' => 'sp_league',
'name' => 'sp_league', 'name' => 'sp_league',
'selected' => $league_id 'selected' => $league_id,
'value' => 'term_id'
); );
sp_dropdown_taxonomies( $args ); sp_dropdown_taxonomies( $args );
?> ?>

View File

@@ -1,63 +0,0 @@
<?php
add_shortcode( 'sp_table', 'sp_table_shortcode' );
function sp_table_shortcode( $atts, $content = null, $code = "" ) {
global $sp_table_stats_labels;
extract( shortcode_atts( array(
'limit' => 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 = '<table class="sp_table">
<thead>
<tr>
<th class="pos">' . __( 'Position', 'sportspress' ) . '</th>';
foreach( $stats as $stat ) {
$output .= '<th class="' . $stat . '">' . $sp_table_stats_labels[$stat] . '</th>';
}
$output .=
'</tr>
</thead>
<tbody>';
// insert rows
$rownum = 0;
foreach ( $teams as $club ) {
$rownum ++;
$club_stats = $club->tb_stats;
$output .=
'<tr class="' . ( $center == $club->ID ? 'highlighted ' : '' ) . ( $rownum % 2 == 0 ? 'even' : 'odd' ) . ( $rownum == $limit ? ' last' : '' ) . '">';
$output .= '<td class="club"><span class="pos">' . $club->place . '</span> ' . ( $club_links ? '<a class="tb-club-link" href="' . get_permalink( $club->ID ) . '">' : '' ) . get_the_post_thumbnail( $club->ID, 'crest-small', array( 'title' => $club->post_title, 'class' => 'crest' ) ) . ' <span class="name">' . $club->post_title . ( $club_links ? '</a>' : '' ) . '</span></td>';
foreach( $stats as $stat ) {
$output .= '<td class="' . $stat . '">' . $club_stats[$stat] . '</td>';
}
}
$output.=
'</tbody>
</table>';
if ( isset( $linkpage ) )
$output .= '<a href="' . get_page_link( $linkpage ) . '" class="tb_view_all">' . $linktext . '</a>';
$output .= '</section>';
return $output;
}
?>

109
presets/baseball.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
global $sportspress_sports;
$sportspress_sports['baseball'] = array(
'name' => __( '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' )
)
)
)
);

109
presets/basketball.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
global $sportspress_sports;
$sportspress_sports['basketball'] = array(
'name' => __( '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' )
)
)
)
);

109
presets/cricket.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
global $sportspress_sports;
$sportspress_sports['cricket'] = array(
'name' => __( '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' )
)
)
)
);

104
presets/football.php Normal file
View File

@@ -0,0 +1,104 @@
<?php
global $sportspress_sports;
$sportspress_sports['football'] = array(
'name' => __( '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' )
)
)
)
);

109
presets/footy.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
global $sportspress_sports;
$sportspress_sports['footy'] = array(
'name' => __( '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' )
)
)
)
);

109
presets/gaming.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
global $sportspress_sports;
$sportspress_sports['gaming'] = array(
'name' => __( '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' )
)
)
)
);

109
presets/golf.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
global $sportspress_sports;
$sportspress_sports['golf'] = array(
'name' => __( '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' )
)
)
)
);

109
presets/handball.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
global $sportspress_sports;
$sportspress_sports['handball'] = array(
'name' => __( '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' )
)
)
)
);

109
presets/hockey.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
global $sportspress_sports;
$sportspress_sports['hockey'] = array(
'name' => __( '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' )
)
)
)
);

109
presets/racing.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
global $sportspress_sports;
$sportspress_sports['racing'] = array(
'name' => __( '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' )
)
)
)
);

109
presets/rugby.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
global $sportspress_sports;
$sportspress_sports['rugby'] = array(
'name' => __( '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' )
)
)
)
);

109
presets/soccer.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
global $sportspress_sports;
$sportspress_sports['soccer'] = 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' => __( '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' )
)
)
)
);

109
presets/swimming.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
global $sportspress_sports;
$sportspress_sports['swimming'] = array(
'name' => __( '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' )
)
)
)
);

109
presets/tennis.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
global $sportspress_sports;
$sportspress_sports['tennis'] = array(
'name' => __( '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' )
)
)
)
);

109
presets/volleyball.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
global $sportspress_sports;
$sportspress_sports['volleyball'] = array(
'name' => __( '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' )
)
)
)
);

111
sports.php Normal file
View File

@@ -0,0 +1,111 @@
<?php
$sportspress_sports = array(
'soccer' => 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' )
)
)
)
)
);
?>

View File

@@ -10,12 +10,26 @@ function sp_after_theme_setup() {
} }
add_action( 'after_theme_setup', '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' ) ) if ( ! current_user_can( 'manage_options' ) )
return; return;
global $menu, $submenu; 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 // Remove "Leagues" link under Events
unset( $submenu['edit.php?post_type=sp_event'][15] ); unset( $submenu['edit.php?post_type=sp_event'][15] );

View File

@@ -7,6 +7,7 @@ if ( !function_exists( 'sportspress_install' ) ) {
$role = get_role( 'administrator' ); $role = get_role( 'administrator' );
// Events // Events
$role->add_cap( 'edit_sp_event' );
$role->add_cap( 'edit_sp_events' ); $role->add_cap( 'edit_sp_events' );
$role->add_cap( 'edit_others_sp_events' ); $role->add_cap( 'edit_others_sp_events' );
$role->add_cap( 'delete_sp_events' ); $role->add_cap( 'delete_sp_events' );
@@ -15,14 +16,16 @@ if ( !function_exists( 'sportspress_install' ) ) {
$role->add_cap( 'read_private_sp_events' ); $role->add_cap( 'read_private_sp_events' );
// Teams // Teams
$role->add_cap( 'edit_sp_staff' ); $role->add_cap( 'edit_sp_team' );
$role->add_cap( 'edit_others_sp_staff' ); $role->add_cap( 'edit_sp_teams' );
$role->add_cap( 'delete_sp_staff' ); $role->add_cap( 'edit_others_sp_teams' );
$role->add_cap( 'publish_sp_staff' ); $role->add_cap( 'delete_sp_teams' );
$role->add_cap( 'read_sp_staff' ); $role->add_cap( 'publish_sp_teams' );
$role->add_cap( 'read_private_sp_staff' ); $role->add_cap( 'read_sp_teams' );
$role->add_cap( 'read_private_sp_teams' );
// League Tables // League Tables
$role->add_cap( 'edit_sp_table' );
$role->add_cap( 'edit_sp_tables' ); $role->add_cap( 'edit_sp_tables' );
$role->add_cap( 'edit_others_sp_tables' ); $role->add_cap( 'edit_others_sp_tables' );
$role->add_cap( 'delete_sp_tables' ); $role->add_cap( 'delete_sp_tables' );
@@ -31,6 +34,7 @@ if ( !function_exists( 'sportspress_install' ) ) {
$role->add_cap( 'read_private_sp_tables' ); $role->add_cap( 'read_private_sp_tables' );
// Players // Players
$role->add_cap( 'edit_sp_player' );
$role->add_cap( 'edit_sp_players' ); $role->add_cap( 'edit_sp_players' );
$role->add_cap( 'edit_others_sp_players' ); $role->add_cap( 'edit_others_sp_players' );
$role->add_cap( 'delete_sp_players' ); $role->add_cap( 'delete_sp_players' );
@@ -39,6 +43,7 @@ if ( !function_exists( 'sportspress_install' ) ) {
$role->add_cap( 'read_private_sp_players' ); $role->add_cap( 'read_private_sp_players' );
// Player Lists // Player Lists
$role->add_cap( 'edit_sp_list' );
$role->add_cap( 'edit_sp_lists' ); $role->add_cap( 'edit_sp_lists' );
$role->add_cap( 'edit_others_sp_lists' ); $role->add_cap( 'edit_others_sp_lists' );
$role->add_cap( 'delete_sp_lists' ); $role->add_cap( 'delete_sp_lists' );
@@ -48,19 +53,21 @@ if ( !function_exists( 'sportspress_install' ) ) {
// Staff // Staff
$role->add_cap( 'edit_sp_staff' ); $role->add_cap( 'edit_sp_staff' );
$role->add_cap( 'edit_others_sp_staff' ); $role->add_cap( 'edit_sp_staffs' );
$role->add_cap( 'delete_sp_staff' ); $role->add_cap( 'edit_others_sp_staffs' );
$role->add_cap( 'publish_sp_staff' ); $role->add_cap( 'delete_sp_staffs' );
$role->add_cap( 'read_sp_staff' ); $role->add_cap( 'publish_sp_staffs' );
$role->add_cap( 'read_private_sp_staff' ); $role->add_cap( 'read_sp_staffs' );
$role->add_cap( 'read_private_sp_staffs' );
// Settings // Settings
$role->add_cap( 'edit_sp_settings' ); $role->add_cap( 'edit_sp_config' );
$role->add_cap( 'edit_others_sp_settings' ); $role->add_cap( 'edit_sp_configs' );
$role->add_cap( 'delete_sp_settings' ); $role->add_cap( 'edit_others_sp_configs' );
$role->add_cap( 'publish_sp_settings' ); $role->add_cap( 'delete_sp_configs' );
$role->add_cap( 'read_sp_settings' ); $role->add_cap( 'publish_sp_configs' );
$role->add_cap( 'read_private_sp_settings' ); $role->add_cap( 'read_sp_configs' );
$role->add_cap( 'read_private_sp_configs' );
// Team Manager // Team Manager
remove_role( 'sp_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' => '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' => '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' => '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 // Statistics
array( 'post_title' => 'Appearances', 'post_name' => 'appearances', 'post_status' => 'publish', 'post_type' => 'sp_statistic', 'meta' => array( 'sp_equation' => '$eventsplayed' ) ), array( 'post_title' => 'Appearances', 'post_name' => 'appearances', 'post_status' => 'publish', 'post_type' => 'sp_statistic', 'meta' => array( 'sp_equation' => '$eventsplayed' ) ),

View File

@@ -108,7 +108,8 @@ if ( !function_exists( 'sp_dropdown_taxonomies' ) ) {
'show_option_none' => false, 'show_option_none' => false,
'taxonomy' => null, 'taxonomy' => null,
'name' => null, 'name' => null,
'selected' => null 'selected' => null,
'value' => 'slug'
); );
$args = array_merge( $defaults, $args ); $args = array_merge( $defaults, $args );
$terms = get_terms( $args['taxonomy'] ); $terms = get_terms( $args['taxonomy'] );
@@ -122,7 +123,10 @@ if ( !function_exists( 'sp_dropdown_taxonomies' ) ) {
printf( '<option value="-1">%s</option>', $args['show_option_none'] ); printf( '<option value="-1">%s</option>', $args['show_option_none'] );
} }
foreach ( $terms as $term ) { foreach ( $terms as $term ) {
printf( '<option value="%s" %s>%s</option>', $term->term_id, selected( true, $args['selected'] == $term->term_id, false ), $term->name ); if ( $args['value'] == 'term_id' )
printf( '<option value="%s" %s>%s</option>', $term->term_id, selected( true, $args['selected'] == $term->term_id, false ), $term->name );
else
printf( '<option value="%s" %s>%s</option>', $term->slug, selected( true, $args['selected'] == $term->slug, false ), $term->name );
} }
print( '</select>' ); print( '</select>' );
} }

View File

@@ -1,4 +1,21 @@
<?php <?php
$sportspress_sports = array();
include_once dirname( __FILE__ ) . '/presets/football.php';
include_once dirname( __FILE__ ) . '/presets/footy.php';
include_once dirname( __FILE__ ) . '/presets/baseball.php';
include_once dirname( __FILE__ ) . '/presets/basketball.php';
include_once dirname( __FILE__ ) . '/presets/gaming.php';
include_once dirname( __FILE__ ) . '/presets/cricket.php';
include_once dirname( __FILE__ ) . '/presets/golf.php';
include_once dirname( __FILE__ ) . '/presets/handball.php';
include_once dirname( __FILE__ ) . '/presets/hockey.php';
include_once dirname( __FILE__ ) . '/presets/racing.php';
include_once dirname( __FILE__ ) . '/presets/rugby.php';
include_once dirname( __FILE__ ) . '/presets/soccer.php';
include_once dirname( __FILE__ ) . '/presets/swimming.php';
include_once dirname( __FILE__ ) . '/presets/tennis.php';
include_once dirname( __FILE__ ) . '/presets/volleyball.php';
$sportspress_texts = array( $sportspress_texts = array(
'sp_team' => array( 'sp_team' => array(
'Enter title here' => __( 'Team', 'sportspress' ), 'Enter title here' => __( 'Team', 'sportspress' ),
@@ -50,20 +67,4 @@ $sportspress_thumbnail_texts = array(
'Remove featured image' => sprintf( __( 'Remove %s', 'sportspress' ), __( 'Photo', 'sportspress' ) ) '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 );
}
}
?> ?>

View File

@@ -1,6 +1,7 @@
<?php <?php
// Flush rewrite rules on activation to make sure permalinks work properly // Flush rewrite rules on activation to make sure permalinks work properly
function sp_rewrite_flush() { function sp_rewrite_flush() {
sp_config_cpt_init();
sp_event_cpt_init(); sp_event_cpt_init();
sp_team_cpt_init(); sp_team_cpt_init();
sp_table_cpt_init(); sp_table_cpt_init();

View File

@@ -16,14 +16,13 @@ function sportspress_settings() {
?> ?>
<div class="wrap"> <div class="wrap">
<div id="icon-themes" class="icon32"></div> <div id="icon-options-general" class="icon32"></div>
<h2><?php _e( 'SportsPress Settings', 'sportspress' ); ?></h2> <h2><?php _e( 'SportsPress Settings', 'sportspress' ); ?></h2>
<?php settings_errors(); ?>
<form method="post" action="options.php"> <form method="post" action="options.php">
<?php <?php
settings_fields( 'sportspress_stats' ); settings_fields( 'sportspress' );
do_settings_sections( 'sportspress_stats' ); do_settings_sections( 'sportspress' );
submit_button(); submit_button();
?> ?>
</form> </form>
@@ -32,91 +31,82 @@ function sportspress_settings() {
<?php <?php
} }
function sportspress_default_stats() { function sportspress_validate( $input ) {
$defaults = array( $original = get_option( 'sportspress' );
'team' => __( 'P', 'sportspress' ) . ': $appearances' . "\r\n" . if ( sp_array_value( $original, 'sport', null ) != sp_array_value( $input, 'sport', null ) ):
__( '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',
'event' => __( 'Goals', 'sportspress' ) . ': $goals' . "\r\n" . global $sportspress_sports;
__( '1st Half', 'sportspress' ) . ': $firsthalf' . "\r\n" .
__( '2nd Half', 'sportspress' ) . ': $secondhalf',
'player' => __( 'Goals', 'sportspress' ) . ': $goals' . "\r\n" . $post_groups = sp_array_value( sp_array_value( $sportspress_sports, sp_array_value( $input, 'sport', null ), array() ), 'posts', array() );
__( 'Assists', 'sportspress' ) . ': $assists' . "\r\n" .
__( 'Yellow Cards', 'sportspress' ) . ': $yellowcards' . "\r\n" .
__( 'Red Cards', 'sportspress' ) . ': $redcards'
); foreach( $post_groups as $post_type => $posts ):
return apply_filters( 'sportspress_default_stats', $defaults ); // 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() { function sportspress_register_settings() {
if( false == get_option( 'sportspress_stats' ) ) { register_setting(
add_option( 'sportspress_stats', apply_filters( 'sportspress_default_stats', sportspress_default_stats() ) ); 'sportspress',
} 'sportspress',
'sportspress_validate'
);
add_settings_section( add_settings_section(
'sportspress_stats', 'general',
'', '',
'', '',
'sportspress_stats' 'sportspress'
); );
add_settings_field( add_settings_field(
'sport', 'sport',
__( 'Sport', 'sportspress' ), __( 'Sport', 'sportspress' ),
'sportspress_sport_callback', 'sportspress_sport_callback',
'sportspress_stats', 'sportspress',
'sportspress_stats' 'general'
);
/*
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'
); );
} }
add_action( 'admin_init', 'sportspress_intialize_stats' ); add_action( 'admin_init', 'sportspress_register_settings' );
function sportspress_sport_callback() { function sportspress_sport_callback() {
sportspress_render_option_field( 'sportspress_stats', 'sport', 'sport' ); global $sportspress_sports;
$options = get_option( 'sportspress' );
?>
<select id="sportspress_sport" name="sportspress[sport]">
<?php foreach( $sportspress_sports as $slug => $sport ): ?>
<option value="<?php echo $slug; ?>" <?php selected( $options['sport'], $slug ); ?>><?php echo $sport['name']; ?></option>
<?php endforeach; ?>
</select>
<?
} }
function sportspress_team_stats_callback() { function sportspress_team_stats_callback() {

View File

@@ -22,7 +22,7 @@ define( 'SPORTSPRESS_VERSION', '0.1' );
define( 'SPORTSPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'SPORTSPRESS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
// Libraries // Libraries
include dirname( __FILE__ ) . '/lib/classes/eos.class.php' ; include dirname( __FILE__ ) . '/lib/eos/eos.class.php' ;
// Globals // Globals
include dirname( __FILE__ ) . '/sportspress-globals.php' ; include dirname( __FILE__ ) . '/sportspress-globals.php' ;
@@ -34,6 +34,7 @@ require_once dirname( __FILE__ ) . '/sportspress-functions.php';
include dirname( __FILE__ ) . '/sportspress-settings.php' ; include dirname( __FILE__ ) . '/sportspress-settings.php' ;
// Custom Post Types // Custom Post Types
require_once dirname( __FILE__ ) . '/admin/post-types/separator.php';
require_once dirname( __FILE__ ) . '/admin/post-types/event.php'; require_once dirname( __FILE__ ) . '/admin/post-types/event.php';
require_once dirname( __FILE__ ) . '/admin/post-types/result.php'; require_once dirname( __FILE__ ) . '/admin/post-types/result.php';
require_once dirname( __FILE__ ) . '/admin/post-types/outcome.php'; require_once dirname( __FILE__ ) . '/admin/post-types/outcome.php';
@@ -49,9 +50,6 @@ require_once dirname( __FILE__ ) . '/admin/post-types/staff.php';
require_once dirname( __FILE__ ) . '/admin/terms/league.php'; require_once dirname( __FILE__ ) . '/admin/terms/league.php';
require_once dirname( __FILE__ ) . '/admin/terms/position.php'; require_once dirname( __FILE__ ) . '/admin/terms/position.php';
// Shortcodes
// require_once dirname( __FILE__ ) . '/classes/shortcodes/table.php';
// Defaults // Defaults
include dirname( __FILE__ ) . '/sportspress-defaults.php'; include dirname( __FILE__ ) . '/sportspress-defaults.php';