Add equation examples to admin
This commit is contained in:
@@ -73,4 +73,11 @@
|
|||||||
|
|
||||||
.sp-equation-formula .button .remove:hover {
|
.sp-equation-formula .button .remove:hover {
|
||||||
color: #d00;
|
color: #d00;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-equation-examples .button {
|
||||||
|
color: #555 !important;
|
||||||
|
border-color: #ccc !important;
|
||||||
|
-webkit-box-shadow: 0 1px 0 #ccc !important;
|
||||||
|
box-shadow: 0 1px 0 #ccc !important;
|
||||||
}
|
}
|
||||||
@@ -76,6 +76,13 @@ class SP_Admin_Meta_Boxes {
|
|||||||
'context' => 'normal',
|
'context' => 'normal',
|
||||||
'priority' => 'high',
|
'priority' => 'high',
|
||||||
),
|
),
|
||||||
|
'examples' => array(
|
||||||
|
'title' => __( 'Examples', 'sportspress' ),
|
||||||
|
'save' => 'SP_Meta_Box_Column_Equation_Examples::save',
|
||||||
|
'output' => 'SP_Meta_Box_Column_Equation_Examples::output',
|
||||||
|
'context' => 'normal',
|
||||||
|
'priority' => 'low',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'sp_metric' => array(
|
'sp_metric' => array(
|
||||||
'details' => array(
|
'details' => array(
|
||||||
@@ -101,6 +108,13 @@ class SP_Admin_Meta_Boxes {
|
|||||||
'context' => 'normal',
|
'context' => 'normal',
|
||||||
'priority' => 'high',
|
'priority' => 'high',
|
||||||
),
|
),
|
||||||
|
'examples' => array(
|
||||||
|
'title' => __( 'Examples', 'sportspress' ),
|
||||||
|
'save' => 'SP_Meta_Box_Statistic_Equation_Examples::save',
|
||||||
|
'output' => 'SP_Meta_Box_Statistic_Equation_Examples::output',
|
||||||
|
'context' => 'normal',
|
||||||
|
'priority' => 'low',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'sp_event' => array(
|
'sp_event' => array(
|
||||||
'shortcode' => array(
|
'shortcode' => array(
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Column Equation Examples
|
||||||
|
*
|
||||||
|
* @author ThemeBoy
|
||||||
|
* @category Admin
|
||||||
|
* @package SportsPress/Admin/Meta_Boxes
|
||||||
|
* @version 1.9
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
|
|
||||||
|
if ( ! class_exists( 'SP_Meta_Box_Equation_Examples' ) )
|
||||||
|
include( 'class-sp-meta-box-equation-examples.php' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SP_Meta_Box_Column_Equation_Examples
|
||||||
|
*/
|
||||||
|
class SP_Meta_Box_Column_Equation_Examples extends SP_Meta_Box_Equation_Examples {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output the metabox
|
||||||
|
*/
|
||||||
|
public static function output( $post ) {
|
||||||
|
$equations = array(
|
||||||
|
'Games Played' => 'Played',
|
||||||
|
'Pts' => 'Win × 3 + Draw',
|
||||||
|
'Win %' => 'Win ÷ Played',
|
||||||
|
'Diff' => 'Points (for) - Points (against)',
|
||||||
|
'GB' => 'Games Back',
|
||||||
|
'Home Goals' => 'Goals (for) @Home',
|
||||||
|
'Strk' => 'Streak',
|
||||||
|
'L10' => 'Last 10',
|
||||||
|
);
|
||||||
|
self::examples( $equations );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Equation examples meta box functions
|
||||||
|
*
|
||||||
|
* @author ThemeBoy
|
||||||
|
* @category Admin
|
||||||
|
* @package SportsPress/Admin/Meta_Boxes
|
||||||
|
* @version 1.9.19
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SP_Meta_Box_Equation_Examples
|
||||||
|
*/
|
||||||
|
class SP_Meta_Box_Equation_Examples {
|
||||||
|
public static function examples( $equations = array() ) {
|
||||||
|
?>
|
||||||
|
<ul class="sp-equation-examples">
|
||||||
|
<?php foreach ( $equations as $label => $equation ): $parts = explode( ' ', $equation ); ?>
|
||||||
|
<p>
|
||||||
|
<strong><?php echo $label; ?> =</strong>
|
||||||
|
<?php foreach ( $parts as $part ): ?>
|
||||||
|
<span class="button button-disabled"><?php echo $part; ?></span>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</p>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Statistic Equation Examples
|
||||||
|
*
|
||||||
|
* @author ThemeBoy
|
||||||
|
* @category Admin
|
||||||
|
* @package SportsPress/Admin/Meta_Boxes
|
||||||
|
* @version 1.9
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||||
|
|
||||||
|
if ( ! class_exists( 'SP_Meta_Box_Equation_Examples' ) )
|
||||||
|
include( 'class-sp-meta-box-equation-examples.php' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SP_Meta_Box_Statistic_Equation_Examples
|
||||||
|
*/
|
||||||
|
class SP_Meta_Box_Statistic_Equation_Examples extends SP_Meta_Box_Equation_Examples {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output the metabox
|
||||||
|
*/
|
||||||
|
public static function output( $post ) {
|
||||||
|
$equations = array(
|
||||||
|
'Appearances' => 'Played',
|
||||||
|
'Win Ratio' => '( Win ÷ Played ) × 100',
|
||||||
|
'Batting Avg' => 'Hits ÷ At Bats',
|
||||||
|
'Minutes / Game' => 'Min ÷ Played',
|
||||||
|
'Goal %' => 'Goals ÷ Attempts',
|
||||||
|
'Blocks / Set' => 'Blocks ÷ Sets',
|
||||||
|
);
|
||||||
|
self::examples( $equations );
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user