Add completed football preset and display statistics per player position
This commit is contained in:
@@ -3,164 +3,889 @@ global $sportspress_sports;
|
||||
|
||||
$sportspress_sports['football'] = array(
|
||||
'name' => __( 'American Football', 'sportspress' ),
|
||||
'terms' => array(
|
||||
// Positions
|
||||
'sp_position' => array(
|
||||
array(
|
||||
'name' => 'Quarterback',
|
||||
'slug' => 'quarterback',
|
||||
),
|
||||
array(
|
||||
'name' => 'Running Back',
|
||||
'slug' => 'runningback',
|
||||
),
|
||||
array(
|
||||
'name' => 'Wide Receiver',
|
||||
'slug' => 'widereceiver',
|
||||
),
|
||||
array(
|
||||
'name' => 'Tight End',
|
||||
'slug' => 'tightend',
|
||||
),
|
||||
array(
|
||||
'name' => 'Defensive Lineman',
|
||||
'slug' => 'defensivelineman',
|
||||
),
|
||||
array(
|
||||
'name' => 'Linebacker',
|
||||
'slug' => 'linebacker',
|
||||
),
|
||||
array(
|
||||
'name' => 'Defensive Back',
|
||||
'slug' => 'defensiveback',
|
||||
),
|
||||
array(
|
||||
'name' => 'Kickoff Kicker',
|
||||
'slug' => 'kickoffkicker',
|
||||
),
|
||||
array(
|
||||
'name' => 'Kick Returner',
|
||||
'slug' => 'kickreturner',
|
||||
),
|
||||
array(
|
||||
'name' => 'Punter',
|
||||
'slug' => 'punter',
|
||||
),
|
||||
array(
|
||||
'name' => 'Punt Returner',
|
||||
'slug' => 'puntreturner',
|
||||
),
|
||||
array(
|
||||
'name' => 'Field Goal Kicker',
|
||||
'slug' => 'fieldgoalkicker',
|
||||
),
|
||||
),
|
||||
),
|
||||
'posts' => array(
|
||||
// Results
|
||||
'sp_result' => array(
|
||||
array(
|
||||
'post_title' => '1',
|
||||
'post_name' => 'one',
|
||||
),
|
||||
array(
|
||||
'post_title' => '2',
|
||||
'post_name' => 'two',
|
||||
),
|
||||
array(
|
||||
'post_title' => '3',
|
||||
'post_name' => 'three',
|
||||
),
|
||||
array(
|
||||
'post_title' => '4',
|
||||
'post_name' => 'four',
|
||||
),
|
||||
array(
|
||||
'post_title' => 'TD',
|
||||
'post_name' => 'td',
|
||||
),
|
||||
array(
|
||||
'post_title' => 'T',
|
||||
'post_name' => 't',
|
||||
),
|
||||
),
|
||||
// Outcomes
|
||||
'sp_outcome' => array(
|
||||
array(
|
||||
'post_title' => 'W',
|
||||
'post_name' => 'w',
|
||||
),
|
||||
array(
|
||||
'post_title' => 'L',
|
||||
'post_name' => 'l',
|
||||
),
|
||||
array(
|
||||
'post_title' => 'T',
|
||||
'post_name' => 't',
|
||||
),
|
||||
),
|
||||
// Table Columns
|
||||
'sp_column' => array(
|
||||
array(
|
||||
'post_title' => 'W',
|
||||
'post_name' => 'w',
|
||||
'meta' => array(
|
||||
'meta' => array(
|
||||
'sp_equation' => '$w',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'L',
|
||||
'post_name' => 'l',
|
||||
'meta' => array(
|
||||
'meta' => array(
|
||||
'sp_equation' => '$l',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'T',
|
||||
'post_name' => 't',
|
||||
'meta' => array(
|
||||
'meta' => array(
|
||||
'sp_equation' => '$t',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Pct',
|
||||
'post_name' => 'pct',
|
||||
'meta' => array(
|
||||
'meta' => array(
|
||||
'sp_equation' => '$w / $eventsplayed',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'PF',
|
||||
'post_name' => 'pf',
|
||||
'meta' => array(
|
||||
'sp_equation' => '$pointsfor',
|
||||
'meta' => array(
|
||||
'sp_equation' => '$tfor',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'PA',
|
||||
'post_name' => 'pa',
|
||||
'meta' => array(
|
||||
'sp_equation' => '$pointsagainst',
|
||||
'meta' => array(
|
||||
'sp_equation' => '$tagainst',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Net Pts',
|
||||
'post_name' => 'netpts',
|
||||
'meta' => array(
|
||||
'sp_equation' => '$pointsfor - $pointsagainst',
|
||||
'meta' => array(
|
||||
'sp_equation' => '$tfor - $tagainst',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'TD',
|
||||
'post_name' => 'td',
|
||||
'meta' => array(
|
||||
'sp_equation' => '$touchdown',
|
||||
'meta' => array(
|
||||
'sp_equation' => '$td',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Strk',
|
||||
'post_name' => 'strk',
|
||||
'meta' => array(
|
||||
'meta' => array(
|
||||
'sp_equation' => '$streak',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Last 5',
|
||||
'post_name' => 'last5',
|
||||
'meta' => array(
|
||||
'meta' => array(
|
||||
'sp_equation' => '$last5',
|
||||
),
|
||||
),
|
||||
),
|
||||
// Statistics
|
||||
// Player Metrics
|
||||
'sp_metric' => array(
|
||||
array(
|
||||
'post_title' => 'Height',
|
||||
'post_name' => 'height',
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Weight',
|
||||
'post_name' => 'weight',
|
||||
),
|
||||
),
|
||||
// Player Statistics
|
||||
'sp_statistic' => array(
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp', // QB
|
||||
'post_name' => 'comp',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'quarterback',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'Att',
|
||||
'post_name' => 'att',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'quarterback',
|
||||
'runningback',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'Pct',
|
||||
'post_name' => 'pct',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'quarterback',
|
||||
'kickoffkicker',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'average',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'Att/G',
|
||||
'post_name' => 'attg',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'quarterback',
|
||||
'runningback',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'Rec',
|
||||
'post_name' => 'rec',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'widereceiver',
|
||||
'tightend',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'Comb',
|
||||
'post_name' => 'comb',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'defensivelineman',
|
||||
'linebacker',
|
||||
'defensiveback',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'Total',
|
||||
'post_name' => 'total',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'defensivelineman',
|
||||
'linebacker',
|
||||
'defensiveback',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'Ast',
|
||||
'post_name' => 'ast',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'defensivelineman',
|
||||
'linebacker',
|
||||
'defensiveback',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'Sck',
|
||||
'post_name' => 'scktackles',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'defensivelineman',
|
||||
'linebacker',
|
||||
'defensiveback',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'SFTY',
|
||||
'post_name' => 'sfty',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'defensivelineman',
|
||||
'linebacker',
|
||||
'defensiveback',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'PDef',
|
||||
'post_name' => 'pdef',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'defensivelineman',
|
||||
'linebacker',
|
||||
'defensiveback',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'TDs',
|
||||
'post_name' => 'tds',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'defensivelineman',
|
||||
'linebacker',
|
||||
'defensiveback',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'KO',
|
||||
'post_name' => 'ko',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'kickoffkicker',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'Ret',
|
||||
'post_name' => 'ret',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'kickreturner',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'Punts',
|
||||
'post_name' => 'punts',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'punter',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'Yds',
|
||||
'post_name' => 'yds',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'quarterback',
|
||||
'runningback',
|
||||
'widereceiver',
|
||||
'tightend',
|
||||
'defensivelineman',
|
||||
'linebacker',
|
||||
'defensiveback',
|
||||
'kickoffkicker',
|
||||
'kickreturner',
|
||||
'punter',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'Net Yds',
|
||||
'post_name' => 'netyds',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'punter',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'Avg',
|
||||
'post_name' => 'avg',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'quarterback',
|
||||
'runningback',
|
||||
'widereceiver',
|
||||
'tightend',
|
||||
'kickoffkicker',
|
||||
'kickreturner',
|
||||
'punter',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'average',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Comp',
|
||||
'post_name' => 'comp',
|
||||
'post_title' => 'Net Avg',
|
||||
'post_name' => 'netavg',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'punter',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'average',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Blk',
|
||||
'post_name' => 'blk',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'punter',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'OOB',
|
||||
'post_name' => 'oob',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'kickoffkicker',
|
||||
'punter',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Dn',
|
||||
'post_name' => 'dn',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'punter',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'IN 20',
|
||||
'post_name' => 'in20',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'punter',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'TB',
|
||||
'post_name' => 'tb',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'punter',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'FC',
|
||||
'post_name' => 'fc',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'kickreturner',
|
||||
'punter',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Ret',
|
||||
'post_name' => 'retpunt',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'kickoffkicker',
|
||||
'kickreturner',
|
||||
'punter',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'RetY',
|
||||
'post_name' => 'rety',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'kickreturner',
|
||||
'punter',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Yds/G',
|
||||
'post_name' => 'ydsg',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'quarterback',
|
||||
'runningback',
|
||||
'widereceiver',
|
||||
'tightend',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'TD',
|
||||
'post_name' => 'TD',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'quarterback',
|
||||
'runningback',
|
||||
'widereceiver',
|
||||
'tightend',
|
||||
'defensivelineman',
|
||||
'linebacker',
|
||||
'defensiveback',
|
||||
'kickreturner',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Int',
|
||||
'post_name' => 'int',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'quarterback',
|
||||
'defensivelineman',
|
||||
'linebacker',
|
||||
'defensiveback',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => '1st',
|
||||
'post_name' => 'first',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'quarterback',
|
||||
'runningback',
|
||||
'widereceiver',
|
||||
'tightend',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => '1st%',
|
||||
'post_name' => 'firstpct',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'quarterback',
|
||||
'runningback',
|
||||
'widereceiver',
|
||||
'tightend',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'average',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Lng',
|
||||
'post_name' => 'lng',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'quarterback',
|
||||
'runningback',
|
||||
'widereceiver',
|
||||
'tightend',
|
||||
'defensivelineman',
|
||||
'linebacker',
|
||||
'defensiveback',
|
||||
'kickreturner',
|
||||
'punter',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => '20+',
|
||||
'post_name' => 'twentyplus',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'quarterback',
|
||||
'runningback',
|
||||
'widereceiver',
|
||||
'tightend',
|
||||
'kickreturner',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => '40+',
|
||||
'post_name' => 'fourtyplus',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'quarterback',
|
||||
'runningback',
|
||||
'widereceiver',
|
||||
'tightend',
|
||||
'kickreturner',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Sck',
|
||||
'post_name' => 'sck',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'quarterback',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Rate',
|
||||
'post_name' => 'rate',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'quarterback',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'FUM',
|
||||
'post_name' => 'fum',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'runningback',
|
||||
'widereceiver',
|
||||
'tightend',
|
||||
'kickreturner',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'FF',
|
||||
'post_name' => 'ff',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'defensivelineman',
|
||||
'linebacker',
|
||||
'defensiveback',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Rec',
|
||||
'post_name' => 'recfum',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'defensivelineman',
|
||||
'linebacker',
|
||||
'defensiveback',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'TD',
|
||||
'post_name' => 'tdfum',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'kickoffkicker',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Avg',
|
||||
'post_name' => 'avgpunt',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'kickoffkicker',
|
||||
'kickreturner',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'average',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Lng',
|
||||
'post_name' => 'lngpunt',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'kickreturner',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'TD',
|
||||
'post_name' => 'tdpunt',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'kickoffkicker',
|
||||
'kickreturner',
|
||||
'punter',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => '20+',
|
||||
'post_name' => 'twentypluspunt',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'kickreturner',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => '40+',
|
||||
'post_name' => 'fourtypluspunt',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'kickreturner',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'FC',
|
||||
'post_name' => 'fcpunt',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'kickreturner',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'FUM',
|
||||
'post_name' => 'fumpunt',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'kickreturner',
|
||||
'puntreturner',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'OSK',
|
||||
'post_name' => 'osk',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'kickoffkicker',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => 'OSKR',
|
||||
'post_name' => 'oskr',
|
||||
'tax_input' => array(
|
||||
'sp_position' => array(
|
||||
'kickoffkicker',
|
||||
),
|
||||
),
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
),
|
||||
// Results
|
||||
'sp_result' => array(
|
||||
),
|
||||
// Outcomes
|
||||
'sp_outcome' => array(
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -7,11 +7,11 @@ $sportspress_sports['rugby'] = array(
|
||||
// Results
|
||||
'sp_result' => array(
|
||||
array(
|
||||
'post_title' => __( 'Points', 'sportspress' ),
|
||||
'post_title' => 'Points',
|
||||
'post_name' => 'points',
|
||||
),
|
||||
array(
|
||||
'post_title' => __( 'Bonus', 'sportspress' ),
|
||||
'post_title' => 'Bonus',
|
||||
'post_name' => 'bonus',
|
||||
),
|
||||
),
|
||||
@@ -110,46 +110,46 @@ $sportspress_sports['rugby'] = array(
|
||||
// Player Metrics
|
||||
'sp_metric' => array(
|
||||
array(
|
||||
'post_title' => __( 'Height', 'sportspress' ),
|
||||
'post_title' => 'Height',
|
||||
'post_name' => 'height',
|
||||
),
|
||||
array(
|
||||
'post_title' => __( 'Weight', 'sportspress' ),
|
||||
'post_title' => 'Weight',
|
||||
'post_name' => 'weight',
|
||||
),
|
||||
),
|
||||
// Player Statistics
|
||||
'sp_statistic' => array(
|
||||
array(
|
||||
'post_title' => __( 'Points', 'sportspress' ),
|
||||
'post_title' => 'Points',
|
||||
'post_name' => 'points',
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => __( 'Tries', 'sportspress' ),
|
||||
'post_title' => 'Tries',
|
||||
'post_name' => 'tries',
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => __( 'Conversions', 'sportspress' ),
|
||||
'post_title' => 'Conversions',
|
||||
'post_name' => 'conversions',
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => __( 'Penalty Goals', 'sportspress' ),
|
||||
'post_title' => 'Penalty Goals',
|
||||
'post_name' => 'penaltygoals',
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => __( 'Drop Goals', 'sportspress' ),
|
||||
'post_title' => 'Drop Goals',
|
||||
'post_name' => 'dropgoals',
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
|
||||
@@ -2,12 +2,20 @@
|
||||
global $sportspress_sports;
|
||||
|
||||
$sportspress_sports['soccer'] = array(
|
||||
'name' => __( 'Association Football (Soccer)', 'sportspress' ),
|
||||
'name' => __( 'Soccer (Association Football)', 'sportspress' ),
|
||||
'posts' => array(
|
||||
// Results
|
||||
'sp_result' => array(
|
||||
array(
|
||||
'post_title' => __( 'Goals', 'sportspress' ),
|
||||
'post_title' => '1st Half',
|
||||
'post_name' => 'firsthalf',
|
||||
),
|
||||
array(
|
||||
'post_title' => '2nd Half',
|
||||
'post_name' => 'secondhalf',
|
||||
),
|
||||
array(
|
||||
'post_title' => 'Goals',
|
||||
'post_name' => 'goals',
|
||||
),
|
||||
),
|
||||
@@ -102,39 +110,39 @@ $sportspress_sports['soccer'] = array(
|
||||
// Player Metrics
|
||||
'sp_metric' => array(
|
||||
array(
|
||||
'post_title' => __( 'Height', 'sportspress' ),
|
||||
'post_title' => 'Height',
|
||||
'post_name' => 'height',
|
||||
),
|
||||
array(
|
||||
'post_title' => __( 'Weight', 'sportspress' ),
|
||||
'post_title' => 'Weight',
|
||||
'post_name' => 'weight',
|
||||
),
|
||||
),
|
||||
// Player Statistics
|
||||
'sp_statistic' => array(
|
||||
array(
|
||||
'post_title' => __( 'Goals', 'sportspress' ),
|
||||
'post_title' => 'Goals',
|
||||
'post_name' => 'goals',
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => __( 'Assists', 'sportspress' ),
|
||||
'post_title' => 'Assists',
|
||||
'post_name' => 'assists',
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => __( 'Yellow Cards', 'sportspress' ),
|
||||
'post_title' => 'Yellow Cards',
|
||||
'post_name' => 'yellowcards',
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'post_title' => __( 'Red Cards', 'sportspress' ),
|
||||
'post_title' => 'Red Cards',
|
||||
'post_name' => 'redcards',
|
||||
'meta' => array(
|
||||
'sp_calculate' => 'sum',
|
||||
|
||||
@@ -83,7 +83,7 @@ function sportspress_settings_init() {
|
||||
register_setting(
|
||||
'sportspress_general',
|
||||
'sportspress',
|
||||
'sportspress_validate'
|
||||
'sportspress_sport_validate'
|
||||
);
|
||||
|
||||
add_settings_section(
|
||||
@@ -125,7 +125,7 @@ function sportspress_settings_init() {
|
||||
}
|
||||
add_action( 'admin_init', 'sportspress_settings_init', 1 );
|
||||
|
||||
function sportspress_validate( $input ) {
|
||||
function sportspress_sport_validate( $input ) {
|
||||
|
||||
$options = get_option( 'sportspress' );
|
||||
|
||||
@@ -137,6 +137,24 @@ function sportspress_validate( $input ) {
|
||||
// Get sports presets
|
||||
global $sportspress_sports;
|
||||
|
||||
// Get array of taxonomies to insert
|
||||
$term_groups = sportspress_array_value( sportspress_array_value( $sportspress_sports, sportspress_array_value( $input, 'sport', null ), array() ), 'terms', array() );
|
||||
|
||||
foreach( $term_groups as $taxonomy => $terms ):
|
||||
// Find empty terms and destroy
|
||||
$allterms = get_terms( $taxonomy, 'hide_empty=0' );
|
||||
|
||||
foreach( $allterms as $term ):
|
||||
if ( $term->count == 0 )
|
||||
wp_delete_term( $term->term_id, $taxonomy );
|
||||
endforeach;
|
||||
|
||||
// Insert terms
|
||||
foreach( $terms as $term ):
|
||||
wp_insert_term( $term['name'], $taxonomy, array( 'slug' => $term['slug'] ) );
|
||||
endforeach;
|
||||
endforeach;
|
||||
|
||||
// Get array of post types to insert
|
||||
$post_groups = sportspress_array_value( sportspress_array_value( $sportspress_sports, sportspress_array_value( $input, 'sport', null ), array() ), 'posts', array() );
|
||||
|
||||
@@ -193,6 +211,17 @@ function sportspress_validate( $input ) {
|
||||
|
||||
endif;
|
||||
|
||||
// Update terms
|
||||
if ( array_key_exists( 'tax_input', $post ) ):
|
||||
|
||||
foreach ( $post['tax_input'] as $taxonomy => $terms ):
|
||||
|
||||
wp_set_object_terms( $id, $terms, $taxonomy, false );
|
||||
|
||||
endforeach;
|
||||
|
||||
endif;
|
||||
|
||||
endif;
|
||||
|
||||
endforeach;
|
||||
|
||||
@@ -112,11 +112,14 @@ if ( !function_exists( 'sportspress_get_post_views' ) ) {
|
||||
$count_key = 'sp_views';
|
||||
$count = get_post_meta( $post_id, $count_key, true );
|
||||
if ( $count == '' ):
|
||||
$count = 0;
|
||||
delete_post_meta( $post_id, $count_key );
|
||||
add_post_meta( $post_id, $count_key, '0' );
|
||||
return sprintf( _n( '1 View', '%1$s Views', '0', 'sportspress' ), '0' );
|
||||
endif;
|
||||
return sprintf( _n( '1 View', '%1$s Views', $count, 'sportspress' ), $count );
|
||||
if ( isset( $views ) && $views == 1 )
|
||||
return __( '1 View', 'sportspress' );
|
||||
else
|
||||
return sprintf( __( '%s Views', 'sportspress' ), $count );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2011,11 +2014,47 @@ if ( !function_exists( 'sportspress_get_player_statistics_data' ) ) {
|
||||
function sportspress_get_player_statistics_data( $post_id, $league_id, $admin = false ) {
|
||||
|
||||
$seasons = (array)get_the_terms( $post_id, 'sp_season' );
|
||||
$positions = get_the_terms( $post_id, 'sp_position' );
|
||||
$stats = (array)get_post_meta( $post_id, 'sp_statistics', true );
|
||||
$seasons_teams = sportspress_array_value( (array)get_post_meta( $post_id, 'sp_leagues', true ), $league_id, array() );
|
||||
|
||||
// Get labels from statistic variables
|
||||
$statistic_labels = (array)sportspress_get_var_labels( 'sp_statistic' );
|
||||
$args = array(
|
||||
'post_type' => 'sp_statistic',
|
||||
'numberposts' => -1,
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC',
|
||||
);
|
||||
|
||||
if ( $positions ):
|
||||
$position_ids = array();
|
||||
foreach( $positions as $position ):
|
||||
$position_ids[] = $position->term_id;
|
||||
endforeach;
|
||||
$args['tax_query'] = array(
|
||||
'relation' => 'OR',
|
||||
array(
|
||||
'taxonomy' => 'sp_position',
|
||||
'field' => 'id',
|
||||
'terms' => $position_ids,
|
||||
),
|
||||
array(
|
||||
'taxonomy' => 'sp_position',
|
||||
'field' => 'id',
|
||||
'operator' => 'NOT SET',
|
||||
),
|
||||
);
|
||||
endif;
|
||||
|
||||
$statistics = get_posts( $args );
|
||||
|
||||
$statistic_labels = array();
|
||||
$equations = array( 'eventsplayed' => 'sum' );
|
||||
foreach ( $statistics as $statistic ):
|
||||
$statistic_labels[ $statistic->post_name ] = $statistic->post_title;
|
||||
$equations[ $statistic->post_name ] = get_post_meta( $statistic->ID, 'sp_calculate', true );
|
||||
endforeach;
|
||||
$columns = array_merge( array( 'eventsplayed' => __( 'Played', 'sportspress' ) ), $statistic_labels );
|
||||
|
||||
// Generate array of all season ids and season names
|
||||
$div_ids = array();
|
||||
@@ -2032,11 +2071,6 @@ if ( !function_exists( 'sportspress_get_player_statistics_data' ) ) {
|
||||
// Get all seasons populated with stats where available
|
||||
$tempdata = sportspress_array_combine( $div_ids, sportspress_array_value( $stats, $league_id, array() ) );
|
||||
|
||||
// Get equations from statistics variables
|
||||
$equations = sportspress_get_var_calculates( 'sp_statistic' );
|
||||
|
||||
$equations['eventsplayed'] = 'sum';
|
||||
|
||||
foreach ( $div_ids as $div_id ):
|
||||
|
||||
$team_id = sportspress_array_value( $seasons_teams, $div_id, '-1' );
|
||||
@@ -2120,12 +2154,6 @@ if ( !function_exists( 'sportspress_get_player_statistics_data' ) ) {
|
||||
|
||||
endforeach;
|
||||
|
||||
// Get columns from statistics variables
|
||||
$columns = array_merge(
|
||||
array( 'eventsplayed' => __( 'Played', 'sportspress' ) ),
|
||||
sportspress_get_var_labels( 'sp_statistic' )
|
||||
);
|
||||
|
||||
// Merge the data and placeholders arrays
|
||||
$merged = array();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user