Remove sport taxonomy and improve equation selectors
This commit is contained in:
@@ -23,7 +23,6 @@ function sp_metric_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Label', 'sportspress' ),
|
||||
'sp_sport' => __( 'Sports', 'sportspress' ),
|
||||
'sp_equation' => __( 'Equation', 'sportspress' ),
|
||||
);
|
||||
return $columns;
|
||||
@@ -31,5 +30,22 @@ function sp_metric_edit_columns() {
|
||||
add_filter( 'manage_edit-sp_metric_columns', 'sp_metric_edit_columns' );
|
||||
|
||||
function sp_metric_meta_init() {
|
||||
add_meta_box( 'sp_equationdiv', __( 'Equation', 'sportspress' ), 'sp_metric_equation_meta', 'sp_metric', 'normal', 'high' );
|
||||
}
|
||||
|
||||
function sp_metric_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( 'event' ) );
|
||||
endforeach;
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
sp_nonce();
|
||||
}
|
||||
?>
|
||||
@@ -23,13 +23,29 @@ function sp_outcome_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Label', 'sportspress' ),
|
||||
'sp_sport' => __( 'Sports', 'sportspress' ),
|
||||
'sp_equation' => __( 'Conditions', 'sportspress' ),
|
||||
'sp_equation' => __( 'Equation', '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();
|
||||
}
|
||||
?>
|
||||
@@ -12,7 +12,6 @@ function sp_result_cpt_init() {
|
||||
'show_in_nav_menus' => false,
|
||||
'hierarchical' => false,
|
||||
'supports' => array( 'title', 'page-attributes' ),
|
||||
'register_meta_box_cb' => 'sp_result_meta_init',
|
||||
'show_in_menu' => 'edit.php?post_type=sp_event'
|
||||
);
|
||||
register_post_type( 'sp_result', $args );
|
||||
@@ -22,14 +21,9 @@ add_action( 'init', 'sp_result_cpt_init' );
|
||||
function sp_result_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Label', 'sportspress' ),
|
||||
'sp_sport' => __( 'Sports', 'sportspress' ),
|
||||
'sp_equation' => __( 'Equation', 'sportspress' ),
|
||||
'title' => __( 'Label', 'sportspress' )
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_result_columns', 'sp_result_edit_columns' );
|
||||
|
||||
function sp_result_meta_init() {
|
||||
}
|
||||
?>
|
||||
@@ -24,7 +24,6 @@ function sp_stat_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Label', 'sportspress' ),
|
||||
'sp_sport' => __( 'Sports', 'sportspress' ),
|
||||
'sp_equation' => __( 'Equation', 'sportspress' ),
|
||||
);
|
||||
return $columns;
|
||||
@@ -42,7 +41,7 @@ function sp_stat_equation_meta( $post ) {
|
||||
<p class="sp-equation-selector">
|
||||
<?php
|
||||
foreach ( $equation as $piece ):
|
||||
sp_get_equation_selector( $post->ID, 'stat', $piece );
|
||||
sp_get_equation_selector( $post->ID, $piece, array( 'event', 'result', 'outcome' ) );
|
||||
endforeach;
|
||||
?>
|
||||
</p>
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
function sp_sport_term_init() {
|
||||
$name = __( 'Sports', 'sportspress' );
|
||||
$singular_name = __( 'Sport', 'sportspress' );
|
||||
$lowercase_name = __( 'sport', 'sportspress' );
|
||||
$object_type = array( 'sp_result', 'sp_outcome', 'sp_stat', 'sp_metric' );
|
||||
$labels = sp_tax_labels( $name, $singular_name, $lowercase_name );
|
||||
$args = array(
|
||||
'label' => $name,
|
||||
'labels' => $labels,
|
||||
'public' => false,
|
||||
'show_ui' => true,
|
||||
'show_in_nav_menus' => false,
|
||||
'hierarchical' => true,
|
||||
'rewrite' => array( 'slug' => 'sport' )
|
||||
);
|
||||
register_taxonomy( 'sp_sport', $object_type, $args );
|
||||
}
|
||||
add_action( 'init', 'sp_sport_term_init' );
|
||||
?>
|
||||
Reference in New Issue
Block a user