Refactor sp_total_type => sp_type

This commit is contained in:
Brian Miyaji
2017-06-09 01:14:55 +10:00
parent 4f89694b12
commit 4877d8e256
2 changed files with 5 additions and 5 deletions

View File

@@ -26,7 +26,7 @@ class SP_Meta_Box_Statistic_Details extends SP_Meta_Box_Config {
$precision = get_post_meta( $post->ID, 'sp_precision', true );
$section = get_post_meta( $post->ID, 'sp_section', true );
$format = get_post_meta( $post->ID, 'sp_format', true );
$total = get_post_meta( $post->ID, 'sp_total_type', true );
$total = get_post_meta( $post->ID, 'sp_type', true );
$visible = get_post_meta( $post->ID, 'sp_visible', true );
// Defaults
@@ -68,7 +68,7 @@ class SP_Meta_Box_Statistic_Details extends SP_Meta_Box_Config {
</p>
<p><strong><?php _e( 'Type', 'sportspress' ); ?></strong></p>
<p>
<select name="sp_total_type">
<select name="sp_type">
<?php
$options = apply_filters( 'sportspress_statistic_total_types', array( 'total' => __( 'Total', 'sportspress' ), 'average' => __( 'Average', 'sportspress' ) ) );
foreach ( $options as $key => $value ):
@@ -104,7 +104,7 @@ class SP_Meta_Box_Statistic_Details extends SP_Meta_Box_Config {
public static function save( $post_id, $post ) {
self::delete_duplicate( $_POST );
update_post_meta( $post_id, 'sp_section', (int) sp_array_value( $_POST, 'sp_section', -1 ) );
update_post_meta( $post_id, 'sp_total_type', sp_array_value( $_POST, 'sp_total_type', 'total' ) );
update_post_meta( $post_id, 'sp_type', sp_array_value( $_POST, 'sp_type', 'total' ) );
update_post_meta( $post_id, 'sp_format', sp_array_value( $_POST, 'sp_format', 'number' ) );
update_post_meta( $post_id, 'sp_precision', (int) sp_array_value( $_POST, 'sp_precision', 1 ) );
update_post_meta( $post_id, 'sp_visible', sp_array_value( $_POST, 'sp_visible', 1 ) );