Save outcomes using slugs instead of IDs
This commit is contained in:
@@ -13,7 +13,7 @@ function sp_metric_cpt_init() {
|
||||
'hierarchical' => false,
|
||||
'supports' => array( 'title', 'page-attributes' ),
|
||||
'register_meta_box_cb' => 'sp_metric_meta_init',
|
||||
'show_in_menu' => 'edit.php?post_type=sp_player'
|
||||
'show_in_menu' => 'edit.php?post_type=sp_event'
|
||||
);
|
||||
register_post_type( 'sp_metric', $args );
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ function sp_outcome_cpt_init() {
|
||||
'show_in_nav_menus' => false,
|
||||
'hierarchical' => false,
|
||||
'supports' => array( 'title', 'page-attributes' ),
|
||||
'register_meta_box_cb' => 'sp_outcome_meta_init',
|
||||
'show_in_menu' => 'edit.php?post_type=sp_event'
|
||||
);
|
||||
register_post_type( 'sp_outcome', $args );
|
||||
@@ -22,30 +21,9 @@ add_action( 'init', 'sp_outcome_cpt_init' );
|
||||
function sp_outcome_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Label', 'sportspress' ),
|
||||
'sp_equation' => __( 'Equation', 'sportspress' ),
|
||||
'title' => __( 'Label', 'sportspress' )
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_outcome_columns', 'sp_outcome_edit_columns' );
|
||||
|
||||
function sp_outcome_meta_init() {
|
||||
add_meta_box( 'sp_equationdiv', __( 'Equation', 'sportspress' ), 'sp_outcome_equation_meta', 'sp_outcome', 'normal', 'high' );
|
||||
}
|
||||
|
||||
function sp_outcome_equation_meta( $post ) {
|
||||
$equation = explode( ' ', get_post_meta( $post->ID, 'sp_equation', true ) );
|
||||
?>
|
||||
<div>
|
||||
<p class="sp-equation-selector">
|
||||
<?php
|
||||
foreach ( $equation as $piece ):
|
||||
sp_get_equation_selector( $post->ID, $piece, array( 'result' ) );
|
||||
endforeach;
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
sp_nonce();
|
||||
}
|
||||
?>
|
||||
@@ -7,7 +7,7 @@ function sp_result_cpt_init() {
|
||||
$args = array(
|
||||
'label' => $name,
|
||||
'labels' => $labels,
|
||||
'public' => true,
|
||||
'public' => false,
|
||||
'show_ui' => true,
|
||||
'show_in_nav_menus' => false,
|
||||
'hierarchical' => false,
|
||||
|
||||
@@ -14,7 +14,7 @@ function sp_stat_cpt_init() {
|
||||
'supports' => array( 'title', 'page-attributes' ),
|
||||
'register_meta_box_cb' => 'sp_stat_meta_init',
|
||||
'rewrite' => array( 'slug' => 'stat' ),
|
||||
'show_in_menu' => 'edit.php?post_type=sp_team'
|
||||
'show_in_menu' => 'edit.php?post_type=sp_event'
|
||||
);
|
||||
register_post_type( 'sp_stat', $args );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user