Enable editing Key field in Metrics and Performance
This commit is contained in:
@@ -41,6 +41,7 @@ class SP_Admin_CPT_Metric extends SP_Admin_CPT {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Label', 'sportspress' ),
|
||||
'sp_key' => __( 'Key', 'sportspress' ),
|
||||
'sp_position' => __( 'Positions', 'sportspress' ),
|
||||
);
|
||||
return $columns;
|
||||
|
||||
@@ -32,6 +32,9 @@ class SP_Admin_Meta_Boxes {
|
||||
// Save Outcome Meta Boxes
|
||||
add_action( 'sportspress_process_sp_outcome_meta', 'SP_Meta_Box_Outcome_Details::save', 10, 2 );
|
||||
|
||||
// Save Metric Meta Boxes
|
||||
add_action( 'sportspress_process_sp_metric_meta', 'SP_Meta_Box_Metric_Details::save', 10, 2 );
|
||||
|
||||
// Save Performance Meta Boxes
|
||||
add_action( 'sportspress_process_sp_performance_meta', 'SP_Meta_Box_Performance_Details::save', 10, 2 );
|
||||
|
||||
@@ -80,12 +83,15 @@ class SP_Admin_Meta_Boxes {
|
||||
// Outcomes
|
||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Outcome_Details::output', 'sp_outcome', 'normal', 'high' );
|
||||
|
||||
// Performance
|
||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Performance_Details::output', 'sp_performance', 'normal', 'high' );
|
||||
|
||||
// Columns
|
||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Column_Details::output', 'sp_column', 'normal', 'high' );
|
||||
|
||||
// Performance
|
||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Metric_Details::output', 'sp_metric', 'normal', 'high' );
|
||||
|
||||
// Performance
|
||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Performance_Details::output', 'sp_performance', 'normal', 'high' );
|
||||
|
||||
// Events
|
||||
add_meta_box( 'sp_formatdiv', __( 'Format', 'sportspress' ), 'SP_Meta_Box_Event_Format::output', 'sp_event', 'side', 'default' );
|
||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Event_Details::output', 'sp_event', 'side', 'default' );
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Metric Details
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @category Admin
|
||||
* @package SportsPress/Admin/Meta Boxes
|
||||
* @version 0.7.3
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
/**
|
||||
* SP_Meta_Box_Metric_Details
|
||||
*/
|
||||
class SP_Meta_Box_Metric_Details {
|
||||
|
||||
/**
|
||||
* Output the metabox
|
||||
*/
|
||||
public static function output( $post ) {
|
||||
wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' );
|
||||
$calculate = get_post_meta( $post->ID, 'sp_calculate', true );
|
||||
?>
|
||||
<p><strong><?php _e( 'Key', 'sportspress' ); ?></strong></p>
|
||||
<p>
|
||||
<input name="sp_key" type="text" id="sp_key" value="<?php echo $post->post_name; ?>">
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Save meta box data
|
||||
*/
|
||||
public static function save( $post_id, $post ) {
|
||||
sp_delete_duplicate_post( $_POST );
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
* @author ThemeBoy
|
||||
* @category Admin
|
||||
* @package SportsPress/Admin/Meta Boxes
|
||||
* @version 0.7
|
||||
* @version 0.7.3
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
@@ -22,6 +22,10 @@ class SP_Meta_Box_Performance_Details {
|
||||
wp_nonce_field( 'sportspress_save_data', 'sportspress_meta_nonce' );
|
||||
$calculate = get_post_meta( $post->ID, 'sp_calculate', true );
|
||||
?>
|
||||
<p><strong><?php _e( 'Key', 'sportspress' ); ?></strong></p>
|
||||
<p>
|
||||
<input name="sp_key" type="text" id="sp_key" value="<?php echo $post->post_name; ?>">
|
||||
</p>
|
||||
<p><strong><?php _e( 'Calculate', 'sportspress' ); ?></strong></p>
|
||||
<p class="sp-calculate-selector">
|
||||
<?php sp_calculate_selector( $post->ID, $calculate ); ?>
|
||||
|
||||
@@ -281,6 +281,7 @@ class SP_Settings_Config extends SP_Settings_Page {
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Positions', 'sportspress' ); ?></th>
|
||||
<th scope="col"> </th>
|
||||
<th scope="col" class="edit"></th>
|
||||
@@ -289,6 +290,7 @@ class SP_Settings_Config extends SP_Settings_Page {
|
||||
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||
<td><?php echo $row->post_name; ?></td>
|
||||
<td><?php echo get_the_terms ( $row->ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '—'; ?></td>
|
||||
<td> </td>
|
||||
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
|
||||
@@ -297,7 +299,7 @@ class SP_Settings_Config extends SP_Settings_Page {
|
||||
</table>
|
||||
<div class="tablenav bottom">
|
||||
<div class="alignleft actions">
|
||||
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_metric' ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></a>
|
||||
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_metric' ); ?>"><?php _e( 'View All', 'sportspress' ); ?></a>
|
||||
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_metric' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
|
||||
</div>
|
||||
<br class="clear">
|
||||
@@ -330,6 +332,7 @@ class SP_Settings_Config extends SP_Settings_Page {
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Positions', 'sportspress' ); ?></th>
|
||||
<th scope="col"><?php _e( 'Calculate', 'sportspress' ); ?></th>
|
||||
<th scope="col" class="edit"></th>
|
||||
@@ -338,6 +341,7 @@ class SP_Settings_Config extends SP_Settings_Page {
|
||||
<?php $i = 0; foreach ( $data as $row ): ?>
|
||||
<tr<?php if ( $i % 2 == 0 ) echo ' class="alternate"'; ?>>
|
||||
<td class="row-title"><?php echo $row->post_title; ?></td>
|
||||
<td><?php echo $row->post_name; ?></td>
|
||||
<td><?php echo get_the_terms ( $row->ID, 'sp_position' ) ? the_terms( $row->ID, 'sp_position' ) : '—'; ?></td>
|
||||
<td><?php echo sp_get_post_calculate( $row->ID ); ?></td>
|
||||
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
|
||||
|
||||
Reference in New Issue
Block a user