Add filters to convert statistic slugs to alphabetic strings

This commit is contained in:
ThemeBoy
2013-11-27 03:10:49 +11:00
parent 639f4b86da
commit 68fa7f30d4
10 changed files with 204 additions and 59 deletions

View File

@@ -7,18 +7,29 @@ function sp_metric_cpt_init() {
$args = array(
'label' => $name,
'labels' => $labels,
'public' => true,
'public' => false,
'show_ui' => true,
'show_in_nav_menus' => false,
'hierarchical' => false,
'supports' => array( 'title', 'page-attributes' ),
'register_meta_box_cb' => 'sp_metric_meta_init',
'rewrite' => array( 'slug' => 'metric' ),
'show_in_menu' => 'edit.php?post_type=sp_player'
);
register_post_type( 'sp_metric', $args );
}
add_action( 'init', 'sp_metric_cpt_init' );
function sp_metric_edit_columns() {
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => __( 'Label', 'sportspress' ),
'sp_sport' => __( 'Sports', 'sportspress' ),
'sp_equation' => __( 'Equation', 'sportspress' ),
);
return $columns;
}
add_filter( 'manage_edit-sp_metric_columns', 'sp_metric_edit_columns' );
function sp_metric_meta_init() {
}
?>

View File

@@ -0,0 +1,35 @@
<?php
function sp_outcome_cpt_init() {
$name = __( 'Outcomes', 'sportspress' );
$singular_name = __( 'Outcome', 'sportspress' );
$lowercase_name = __( 'outcome', 'sportspress' );
$labels = sp_cpt_labels( $name, $singular_name, $lowercase_name, true );
$args = array(
'label' => $name,
'labels' => $labels,
'public' => false,
'show_ui' => true,
'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 );
}
add_action( 'init', 'sp_outcome_cpt_init' );
function sp_outcome_edit_columns() {
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => __( 'Label', 'sportspress' ),
'sp_sport' => __( 'Sports', 'sportspress' ),
'sp_equation' => __( 'Conditions', 'sportspress' ),
);
return $columns;
}
add_filter( 'manage_edit-sp_outcome_columns', 'sp_outcome_edit_columns' );
function sp_outcome_meta_init() {
}
?>

View File

@@ -0,0 +1,35 @@
<?php
function sp_result_cpt_init() {
$name = __( 'Results', 'sportspress' );
$singular_name = __( 'Result', 'sportspress' );
$lowercase_name = __( 'result', 'sportspress' );
$labels = sp_cpt_labels( $name, $singular_name, $lowercase_name, true );
$args = array(
'label' => $name,
'labels' => $labels,
'public' => true,
'show_ui' => true,
'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 );
}
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' ),
);
return $columns;
}
add_filter( 'manage_edit-sp_result_columns', 'sp_result_edit_columns' );
function sp_result_meta_init() {
}
?>

View File

@@ -7,7 +7,8 @@ function sp_stat_cpt_init() {
$args = array(
'label' => $name,
'labels' => $labels,
'public' => true,
'public' => false,
'show_ui' => true,
'show_in_nav_menus' => false,
'hierarchical' => false,
'supports' => array( 'title', 'page-attributes' ),
@@ -23,7 +24,7 @@ function sp_stat_edit_columns() {
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => __( 'Label', 'sportspress' ),
'sp_sport' => __( 'Sport', 'sportspress' ),
'sp_sport' => __( 'Sports', 'sportspress' ),
'sp_equation' => __( 'Equation', 'sportspress' ),
);
return $columns;
@@ -41,7 +42,7 @@ function sp_stat_equation_meta( $post ) {
<p class="sp-equation-selector">
<?php
foreach ( $equation as $piece ):
sp_get_equation_selector( 'stat', $piece );
sp_get_equation_selector( $post->ID, 'stat', $piece );
endforeach;
?>
</p>

View File

@@ -10,7 +10,7 @@ function sp_div_term_init() {
'labels' => $labels,
'public' => true,
'hierarchical' => true,
'rewrite' => array( 'slug' => 'division' ),
'rewrite' => array( 'slug' => 'division' )
);
register_taxonomy( 'sp_div', $object_type, $args );
}

View File

@@ -3,12 +3,14 @@ function sp_sport_term_init() {
$name = __( 'Sports', 'sportspress' );
$singular_name = __( 'Sport', 'sportspress' );
$lowercase_name = __( 'sport', 'sportspress' );
$object_type = array( 'sp_stat', 'sp_metric' );
$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' => true,
'public' => false,
'show_ui' => true,
'show_in_nav_menus' => false,
'hierarchical' => true,
'rewrite' => array( 'slug' => 'sport' )
);