Add description to config post types

This commit is contained in:
Brian Miyaji
2014-04-24 12:18:04 +10:00
parent 63e1ace191
commit feb870c491
8 changed files with 153 additions and 89 deletions

View File

@@ -101,8 +101,8 @@ class SP_Admin_Meta_Boxes {
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Event_Details::output', 'sp_event', 'side', 'default' );
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'SP_Meta_Box_Event_Teams::output', 'sp_event', 'side', 'default' );
add_meta_box( 'sp_videodiv', __( 'Video', 'sportspress' ), 'SP_Meta_Box_Event_Video::output', 'sp_event', 'side', 'low' );
add_meta_box( 'sp_resultsdiv', __( 'Results', 'sportspress' ), 'SP_Meta_Box_Event_Results::output', 'sp_event', 'normal', 'high' );
add_meta_box( 'sp_performancediv', __( 'Performance', 'sportspress' ), 'SP_Meta_Box_Event_Performance::output', 'sp_event', 'normal', 'high' );
add_meta_box( 'sp_resultsdiv', __( 'Team Results', 'sportspress' ), 'SP_Meta_Box_Event_Results::output', 'sp_event', 'normal', 'high' );
add_meta_box( 'sp_performancediv', __( 'Player Performance', 'sportspress' ), 'SP_Meta_Box_Event_Performance::output', 'sp_event', 'normal', 'high' );
add_meta_box( 'sp_editordiv', __( 'Article', 'sportspress' ), 'SP_Meta_Box_Event_Editor::output', 'sp_event', 'normal', 'high' );
// Calendars
@@ -113,7 +113,7 @@ class SP_Admin_Meta_Boxes {
add_meta_box( 'sp_editordiv', __( 'Description', 'sportspress' ), 'SP_Meta_Box_Calendar_Editor::output', 'sp_calendar', 'normal', 'high' );
// Teams
add_meta_box( 'sp_columnssdiv', __( 'Columns', 'sportspress' ), 'SP_Meta_Box_Team_Columns::output', 'sp_team', 'normal', 'high' );
add_meta_box( 'sp_columnssdiv', __( 'Table Columns', 'sportspress' ), 'SP_Meta_Box_Team_Columns::output', 'sp_team', 'normal', 'high' );
add_meta_box( 'sp_editordiv', __( 'Profile', 'sportspress' ), 'SP_Meta_Box_Team_Editor::output', 'sp_team', 'normal', 'high' );
// Tables
@@ -124,8 +124,8 @@ class SP_Admin_Meta_Boxes {
// Players
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'SP_Meta_Box_Player_Details::output', 'sp_player', 'side', 'default' );
add_meta_box( 'sp_metricsdiv', __( 'Metrics', 'sportspress' ), 'SP_Meta_Box_Player_Metrics::output', 'sp_player', 'side', 'default' );
add_meta_box( 'sp_performancediv', __( 'Performance', 'sportspress' ), 'SP_Meta_Box_Player_Performance::output', 'sp_player', 'normal', 'high' );
add_meta_box( 'sp_metricsdiv', __( 'Player Metrics', 'sportspress' ), 'SP_Meta_Box_Player_Metrics::output', 'sp_player', 'side', 'default' );
add_meta_box( 'sp_performancediv', __( 'Player Performance', 'sportspress' ), 'SP_Meta_Box_Player_Performance::output', 'sp_player', 'normal', 'high' );
add_meta_box( 'sp_editordiv', __( 'Profile', 'sportspress' ), 'SP_Meta_Box_Player_Editor::output', 'sp_player', 'normal', 'high' );
// Lists

View File

@@ -24,7 +24,7 @@ class SP_Meta_Box_Event_Shortcode {
<?php _e( 'Copy this code and paste it into your post, page or text widget content.', 'sportspress' ); ?>
</p>
<p>
<strong><?php _e( 'Results', 'sportspress' ); ?></strong>
<strong><?php _e( 'Team Results', 'sportspress' ); ?></strong>
</p>
<p><input type="text" value="[event_results <?php echo $post->ID; ?>]" readonly="readonly" class="wp-ui-text-highlight code"></p>
<p>
@@ -32,7 +32,7 @@ class SP_Meta_Box_Event_Shortcode {
</p>
<p><input type="text" value="[event_details <?php echo $post->ID; ?>]" readonly="readonly" class="wp-ui-text-highlight code"></p>
<p>
<strong><?php _e( 'Performance', 'sportspress' ); ?></strong>
<strong><?php _e( 'Player Performance', 'sportspress' ); ?></strong>
</p>
<p><input type="text" value="[event_performance <?php echo $post->ID; ?>]" readonly="readonly" class="wp-ui-text-highlight code"></p>
<?php

View File

@@ -31,6 +31,7 @@ class SP_Settings_Config extends SP_Settings_Page {
add_action( 'sportspress_admin_field_columns', array( $this, 'columns_setting' ) );
add_action( 'sportspress_admin_field_metrics', array( $this, 'metrics_setting' ) );
add_action( 'sportspress_admin_field_performance', array( $this, 'performance_setting' ) );
add_action( 'sportspress_admin_field_statistics', array( $this, 'statistics_setting' ) );
add_action( 'sportspress_settings_save_' . $this->id, array( $this, 'save' ) );
}
@@ -54,16 +55,16 @@ class SP_Settings_Config extends SP_Settings_Page {
'options' => $sports,
),
array( 'type' => 'results' ),
array( 'type' => 'outcomes' ),
array( 'type' => 'results' ),
array( 'type' => 'performance' ),
array( 'type' => 'columns' ),
array( 'type' => 'metrics' ),
array( 'type' => 'performance' ),
array( 'type' => 'statistics' ),
array( 'type' => 'sectionend', 'id' => 'config_options' ),
@@ -87,6 +88,56 @@ class SP_Settings_Config extends SP_Settings_Page {
SP_Admin_Settings::save_fields( $settings );
}
/**
* Output outcomes settings
*
* @access public
* @return void
*/
public function outcomes_setting() {
$args = array(
'post_type' => 'sp_outcome',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC'
);
$data = get_posts( $args );
?>
<tr valign="top">
<th scope="row" class="titledesc">
<?php _e( 'Event Outcomes', 'sportspress' ) ?>
<p class="description"><?php _e( 'Used for events.' ); ?></p>
</th>
<td class="forminp">
<table class="widefat sp-admin-config-table">
<thead>
<tr>
<th scope="col"><?php _e( 'Label', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Key', 'sportspress' ); ?></th>
<th scope="col" class="edit"></th>
</tr>
</thead>
<?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 class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
</tr>
<?php $i++; endforeach; ?>
</table>
<div class="tablenav bottom">
<div class="alignleft actions">
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_outcome' ); ?>"><?php _e( 'View All', 'sportspress' ); ?></a>
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_outcome' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
</div>
<br class="clear">
</div>
</td>
</tr>
<?php
}
/**
* Results settings
*
@@ -106,10 +157,13 @@ class SP_Settings_Config extends SP_Settings_Page {
$data = get_posts( $args );
?>
<tr valign="top">
<th scope="row" class="titledesc"><?php _e( 'Results', 'sportspress' ) ?></th>
<th scope="row" class="titledesc">
<?php _e( 'Team Results', 'sportspress' ) ?>
<p class="description"><?php _e( 'Used for events.' ); ?></p>
</th>
<td class="forminp">
<fieldset>
<legend class="screen-reader-text"><span><?php _e( 'Results', 'sportspress' ) ?></span></legend>
<legend class="screen-reader-text"><span><?php _e( 'Team Results', 'sportspress' ) ?></span></legend>
<table class="widefat sp-admin-config-table">
<thead>
<tr>
@@ -158,23 +212,26 @@ class SP_Settings_Config extends SP_Settings_Page {
}
/**
* Output outcomes settings
* Output performance settings
*
* @access public
* @return void
*/
public function outcomes_setting() {
public function performance_setting() {
$args = array(
'post_type' => 'sp_outcome',
'post_type' => 'sp_performance',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC'
'orderby' => 'menu_order',
'order' => 'ASC'
);
$data = get_posts( $args );
?>
<tr valign="top">
<th scope="row" class="titledesc"><?php _e( 'Outcomes', 'sportspress' ) ?></th>
<th scope="row" class="titledesc">
<?php _e( 'Player Performance', 'sportspress' ) ?>
<p class="description"><?php _e( 'Used for events.' ); ?></p>
</th>
<td class="forminp">
<table class="widefat sp-admin-config-table">
<thead>
@@ -194,8 +251,8 @@ 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_outcome' ); ?>"><?php _e( 'View All', 'sportspress' ); ?></a>
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_outcome' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_performance' ); ?>"><?php _e( 'View All', 'sportspress' ); ?></a>
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_performance' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
</div>
<br class="clear">
</div>
@@ -221,7 +278,10 @@ class SP_Settings_Config extends SP_Settings_Page {
$data = get_posts( $args );
?>
<tr valign="top">
<th scope="row" class="titledesc"><?php _e( 'Columns', 'sportspress' ) ?></th>
<th scope="row" class="titledesc">
<?php _e( 'Table Columns', 'sportspress' ) ?>
<p class="description"><?php _e( 'Used for league tables.' ); ?></p>
</th>
<td class="forminp">
<table class="widefat sp-admin-config-table">
<thead>
@@ -238,7 +298,7 @@ class SP_Settings_Config extends SP_Settings_Page {
<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 sp_get_post_equation( $row->ID, $row->post_name ); ?></td>
<td><?php echo sp_get_post_equation( $row->ID ); ?></td>
<td><?php echo sp_get_post_precision( $row->ID ); ?></td>
<td><?php echo sp_get_post_order( $row->ID ); ?></td>
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
@@ -275,14 +335,16 @@ class SP_Settings_Config extends SP_Settings_Page {
$data = get_posts( $args );
?>
<tr valign="top">
<th scope="row" class="titledesc"><?php _e( 'Metrics', 'sportspress' ) ?></th>
<th scope="row" class="titledesc">
<?php _e( 'Player Metrics', 'sportspress' ) ?>
<p class="description"><?php _e( 'Used for player lists.' ); ?></p>
</th>
<td class="forminp">
<table class="widefat sp-admin-config-table">
<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">&nbsp;</th>
<th scope="col" class="edit"></th>
</tr>
@@ -291,7 +353,6 @@ class SP_Settings_Config extends SP_Settings_Page {
<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' ) : '&mdash;'; ?></td>
<td>&nbsp;</td>
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
</tr>
@@ -310,14 +371,14 @@ class SP_Settings_Config extends SP_Settings_Page {
}
/**
* Output performance settings
* Output statistics settings
*
* @access public
* @return void
*/
public function performance_setting() {
public function statistics_setting() {
$args = array(
'post_type' => 'sp_performance',
'post_type' => 'sp_statistic',
'numberposts' => -1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
@@ -326,15 +387,18 @@ class SP_Settings_Config extends SP_Settings_Page {
$data = get_posts( $args );
?>
<tr valign="top">
<th scope="row" class="titledesc"><?php _e( 'Performance', 'sportspress' ) ?></th>
<th scope="row" class="titledesc">
<?php _e( 'Player Statistics', 'sportspress' ) ?>
<p class="description"><?php _e( 'Used for player lists.' ); ?></p>
</th>
<td class="forminp">
<table class="widefat sp-admin-config-table">
<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"><?php _e( 'Equation', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Rounding', 'sportspress' ); ?></th>
<th scope="col" class="edit"></th>
</tr>
</thead>
@@ -342,16 +406,16 @@ class SP_Settings_Config extends SP_Settings_Page {
<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' ) : '&mdash;'; ?></td>
<td><?php echo sp_get_post_calculate( $row->ID ); ?></td>
<td><?php echo sp_get_post_equation( $row->ID ); ?></td>
<td><?php echo sp_get_post_precision( $row->ID ); ?></td>
<td class="edit"><a class="button" href="<?php echo get_edit_post_link( $row->ID ); ?>"><?php _e( 'Edit', 'sportspress' ); ?></s></td>
</tr>
<?php $i++; endforeach; ?>
</table>
<div class="tablenav bottom">
<div class="alignleft actions">
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_performance' ); ?>"><?php _e( 'View All', 'sportspress' ); ?></a>
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_performance' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
<a class="button" id="doaction" href="<?php echo admin_url( 'edit.php?post_type=sp_statistic' ); ?>"><?php _e( 'View All', 'sportspress' ); ?></a>
<a class="button" id="doaction2" href="<?php echo admin_url( 'post-new.php?post_type=sp_statistic' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
</div>
<br class="clear">
</div>

View File

@@ -61,7 +61,7 @@ class SP_Settings_Events extends SP_Settings_Page {
),
array(
'title' => __( 'Performance', 'sportspress' ),
'title' => __( 'Player Performance', 'sportspress' ),
'desc' => __( 'Link players', 'sportspress' ),
'id' => 'sportspress_event_link_players',
'default' => 'yes',

View File

@@ -228,7 +228,7 @@
<td><?php echo get_option( 'sportspress_sport', __( 'None', 'sportspress' ) ); ?></td>
</tr>
<tr>
<td><?php _e( 'Results', 'sportspress' ); ?>:</td>
<td><?php _e( 'Team Results', 'sportspress' ); ?>:</td>
<td><?php
$display_posts = array();
$posts = get_posts( array( 'post_type' => 'sp_result', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => -1, 'post_status' => 'any' ) );
@@ -238,7 +238,7 @@
?></td>
</tr>
<tr>
<td><?php _e( 'Outcomes', 'sportspress' ); ?>:</td>
<td><?php _e( 'Event Outcomes', 'sportspress' ); ?>:</td>
<td><?php
$display_posts = array();
$posts = get_posts( array( 'post_type' => 'sp_outcome', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => -1, 'post_status' => 'any' ) );
@@ -248,7 +248,7 @@
?></td>
</tr>
<tr>
<td><?php _e( 'Columns', 'sportspress' ); ?>:</td>
<td><?php _e( 'Table Columns', 'sportspress' ); ?>:</td>
<td><?php
$display_posts = array();
$posts = get_posts( array( 'post_type' => 'sp_column', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => -1, 'post_status' => 'any' ) );
@@ -258,7 +258,7 @@
?></td>
</tr>
<tr>
<td><?php _e( 'Metrics', 'sportspress' ); ?>:</td>
<td><?php _e( 'Player Metrics', 'sportspress' ); ?>:</td>
<td><?php
$display_posts = array();
$posts = get_posts( array( 'post_type' => 'sp_metric', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => -1, 'post_status' => 'any' ) );
@@ -268,7 +268,7 @@
?></td>
</tr>
<tr>
<td><?php _e( 'Performance', 'sportspress' ); ?>:</td>
<td><?php _e( 'Player Performance', 'sportspress' ); ?>:</td>
<td><?php
$display_posts = array();
$posts = get_posts( array( 'post_type' => 'sp_performance', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => -1, 'post_status' => 'any' ) );