Create module for Event Specs

Convert most of the previous changes to the module for easier maintenance
This commit is contained in:
savvasha
2018-02-27 21:28:37 +02:00
parent fa1877747c
commit 9db32d4d3d
5 changed files with 195 additions and 97 deletions

View File

@@ -93,15 +93,6 @@ class SP_Admin_Meta_Boxes {
'priority' => 'high',
),
),
'sp_spec' => array(
'details' => array(
'title' => __( 'Specs', 'sportspress' ),
'save' => 'SP_Meta_Box_Spec_Details::save',
'output' => 'SP_Meta_Box_Spec_Details::output',
'context' => 'normal',
'priority' => 'high',
),
),
'sp_statistic' => array(
'details' => array(
'title' => __( 'Details', 'sportspress' ),
@@ -167,13 +158,6 @@ class SP_Admin_Meta_Boxes {
'context' => 'normal',
'priority' => 'high',
),
'specs' => array(
'title' => __( 'Specs', 'sportspress' ),
'save' => 'SP_Meta_Box_Event_Specs::save',
'output' => 'SP_Meta_Box_Event_Specs::output',
'context' => 'side',
'priority' => 'default',
),
),
'sp_team' => array(
'details' => array(

View File

@@ -34,8 +34,6 @@ function sp_get_screen_ids() {
'sp_column',
'edit-sp_metric',
'sp_metric',
'edit-sp_spec',
'sp_spec',
'edit-sp_statistic',
'sp_statistic',
'edit-sp_event',

View File

@@ -295,55 +295,6 @@ $columns = get_option( 'sportspress_player_columns', 'auto' );
</td>
</tr>
</tbody>
</table>
<table class="form-table">
<tbody>
<?php
$args = array(
'post_type' => 'sp_spec',
'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 Specs', 'sportspress' ) ?>
<p class="description"><?php _e( 'Add more details to an event.', 'sportspress' ); ?></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( 'Variable', 'sportspress' ); ?></th>
<th scope="col"><?php _e( 'Description', 'sportspress' ); ?></th>
<th scope="col" class="edit"></th>
</tr>
</thead>
<?php if ( $data ): $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><code><?php echo $row->post_name; ?></code></td>
<td><p class="description"><?php echo $row->post_excerpt; ?></p></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; else: ?>
<tr class="alternate">
<td colspan="4"><?php _e( 'No results found.', 'sportspress' ); ?></td>
</tr>
<?php endif; ?>
</table>
<div class="tablenav bottom">
<a class="button alignleft" href="<?php echo admin_url( 'edit.php?post_type=sp_spec' ); ?>"><?php _e( 'View All', 'sportspress' ); ?></a>
<a class="button button-primary alignright" href="<?php echo admin_url( 'post-new.php?post_type=sp_spec' ); ?>"><?php _e( 'Add New', 'sportspress' ); ?></a>
<br class="clear">
</div>
</td>
</tr>
</tbody>
</table>
<table class="form-table">
<tbody>