More cleaning and renaming
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
function sportspress_admin_enqueue_scripts() {
|
||||
wp_register_style( 'sportspress-admin', SPORTSPRESS_PLUGIN_URL . 'assets/css/admin.css', array(), time() );
|
||||
wp_enqueue_style( 'sportspress-admin');
|
||||
|
||||
wp_enqueue_script( 'jquery' );
|
||||
wp_enqueue_script( 'sportspress-admin', SPORTSPRESS_PLUGIN_URL .'/assets/js/admin.js', array( 'jquery' ), time(), true );
|
||||
}
|
||||
|
||||
@@ -131,10 +131,6 @@ function sportspress_admin_init() {
|
||||
update_option( 'sportspress_installed', 1 );
|
||||
|
||||
endif;
|
||||
|
||||
// Load admin styles
|
||||
wp_register_style( 'sportspress-admin', SPORTSPRESS_PLUGIN_URL . 'assets/css/admin.css', array(), '1.0' );
|
||||
wp_enqueue_style( 'sportspress-admin');
|
||||
|
||||
// Add settings sections
|
||||
register_setting(
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<?php
|
||||
function sp_manage_posts_columns() {
|
||||
sportspress_highlight_admin_menu();
|
||||
}
|
||||
14
admin/actions/wp-enqueue-scripts.php
Normal file
14
admin/actions/wp-enqueue-scripts.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
function sportspress_enqueue_scripts() {
|
||||
// Styles
|
||||
wp_register_style( 'sportspress', SPORTSPRESS_PLUGIN_URL . 'assets/css/sportspress.css', array(), time() );
|
||||
wp_enqueue_style( 'sportspress');
|
||||
wp_register_style( 'jquery-datatables', SPORTSPRESS_PLUGIN_URL . 'assets/css/jquery.dataTables.css', array(), '1.9.4' );
|
||||
wp_enqueue_style( 'jquery-datatables');
|
||||
|
||||
// Scripts
|
||||
wp_enqueue_script( 'jquery' );
|
||||
wp_enqueue_script( 'jquery-datatables', SPORTSPRESS_PLUGIN_URL .'/assets/js/jquery.dataTables.min.js', array( 'jquery' ), '1.9.4', true );
|
||||
wp_enqueue_script( 'sportspress', SPORTSPRESS_PLUGIN_URL .'/assets/js/sportspress.js', array( 'jquery' ), time(), true );
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'sportspress_enqueue_scripts' );
|
||||
@@ -12,14 +12,14 @@ function sportspress_column_post_init() {
|
||||
'show_in_menu' => false,
|
||||
'hierarchical' => false,
|
||||
'supports' => array( 'title', 'page-attributes' ),
|
||||
'register_meta_box_cb' => 'sp_column_meta_init',
|
||||
'register_meta_box_cb' => 'sportspress_column_meta_init',
|
||||
'capability_type' => 'sp_config'
|
||||
);
|
||||
register_post_type( 'sp_column', $args );
|
||||
}
|
||||
add_action( 'init', 'sportspress_column_post_init' );
|
||||
|
||||
function sp_column_edit_columns() {
|
||||
function sportspress_column_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Label', 'sportspress' ),
|
||||
@@ -30,13 +30,13 @@ function sp_column_edit_columns() {
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_column_columns', 'sp_column_edit_columns' );
|
||||
add_filter( 'manage_edit-sp_column_columns', 'sportspress_column_edit_columns' );
|
||||
|
||||
function sp_column_meta_init() {
|
||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sp_column_details_meta', 'sp_column', 'normal', 'high' );
|
||||
function sportspress_column_meta_init() {
|
||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_column_details_meta', 'sp_column', 'normal', 'high' );
|
||||
}
|
||||
|
||||
function sp_column_details_meta( $post ) {
|
||||
function sportspress_column_details_meta( $post ) {
|
||||
$formats = sportspress_get_config_formats();
|
||||
|
||||
$equation = explode( ' ', get_post_meta( $post->ID, 'sp_equation', true ) );
|
||||
|
||||
@@ -10,7 +10,7 @@ function sportspress_event_post_init() {
|
||||
'public' => true,
|
||||
'hierarchical' => false,
|
||||
'supports' => array( 'title', 'author', 'comments' ),
|
||||
'register_meta_box_cb' => 'sp_event_meta_init',
|
||||
'register_meta_box_cb' => 'sportspress_event_meta_init',
|
||||
'rewrite' => array( 'slug' => get_option( 'sp_event_slug', 'event' ) ),
|
||||
'menu_icon' => 'dashicons-calendar',
|
||||
'capability_type' => 'sp_event'
|
||||
@@ -19,29 +19,29 @@ function sportspress_event_post_init() {
|
||||
}
|
||||
add_action( 'init', 'sportspress_event_post_init' );
|
||||
|
||||
function sp_event_display_scheduled( $posts ) {
|
||||
function sportspress_event_display_scheduled( $posts ) {
|
||||
global $wp_query, $wpdb;
|
||||
if ( is_single() && $wp_query->post_count == 0 && isset( $wp_query->query_vars['sp_event'] )) {
|
||||
$posts = $wpdb->get_results( $wp_query->request );
|
||||
}
|
||||
return $posts;
|
||||
}
|
||||
add_filter( 'the_posts', 'sp_event_display_scheduled' );
|
||||
add_filter( 'the_posts', 'sportspress_event_display_scheduled' );
|
||||
|
||||
function sp_event_meta_init( $post ) {
|
||||
function sportspress_event_meta_init( $post ) {
|
||||
$teams = (array)get_post_meta( $post->ID, 'sp_team', false );
|
||||
|
||||
remove_meta_box( 'submitdiv', 'sp_event', 'side' );
|
||||
add_meta_box( 'submitdiv', __( 'Event', 'sportspress' ), 'post_submit_meta_box', 'sp_event', 'side', 'high' );
|
||||
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sp_event_team_meta', 'sp_event', 'side', 'high' );
|
||||
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_event_team_meta', 'sp_event', 'side', 'high' );
|
||||
if ( sizeof( $teams ) > 0 ):
|
||||
add_meta_box( 'sp_playersdiv', __( 'Players', 'sportspress' ), 'sp_event_players_meta', 'sp_event', 'normal', 'high' );
|
||||
add_meta_box( 'sp_resultsdiv', __( 'Results', 'sportspress' ), 'sp_event_results_meta', 'sp_event', 'normal', 'high' );
|
||||
add_meta_box( 'sp_playersdiv', __( 'Players', 'sportspress' ), 'sportspress_event_players_meta', 'sp_event', 'normal', 'high' );
|
||||
add_meta_box( 'sp_resultsdiv', __( 'Results', 'sportspress' ), 'sportspress_event_results_meta', 'sp_event', 'normal', 'high' );
|
||||
endif;
|
||||
add_meta_box( 'sp_articlediv', __( 'Article', 'sportspress' ), 'sp_event_article_meta', 'sp_event', 'normal', 'high' );
|
||||
add_meta_box( 'sp_articlediv', __( 'Article', 'sportspress' ), 'sportspress_event_article_meta', 'sp_event', 'normal', 'high' );
|
||||
}
|
||||
|
||||
function sp_event_team_meta( $post ) {
|
||||
function sportspress_event_team_meta( $post ) {
|
||||
$teams = (array)get_post_meta( $post->ID, 'sp_team', false );
|
||||
$players = (array)get_post_meta( $post->ID, 'sp_player', false );
|
||||
foreach ( $teams as $key => $value ):
|
||||
@@ -89,7 +89,7 @@ function sp_event_team_meta( $post ) {
|
||||
sportspress_nonce();
|
||||
}
|
||||
|
||||
function sp_event_players_meta( $post ) {
|
||||
function sportspress_event_players_meta( $post ) {
|
||||
$teams = (array)get_post_meta( $post->ID, 'sp_team', false );
|
||||
$stats = (array)get_post_meta( $post->ID, 'sp_players', true );
|
||||
|
||||
@@ -114,7 +114,7 @@ function sp_event_players_meta( $post ) {
|
||||
|
||||
}
|
||||
|
||||
function sp_event_results_meta( $post ) {
|
||||
function sportspress_event_results_meta( $post ) {
|
||||
$teams = (array)get_post_meta( $post->ID, 'sp_team', false );
|
||||
|
||||
$results = (array)get_post_meta( $post->ID, 'sp_results', true );
|
||||
@@ -132,11 +132,11 @@ function sp_event_results_meta( $post ) {
|
||||
<?php
|
||||
}
|
||||
|
||||
function sp_event_article_meta( $post ) {
|
||||
function sportspress_event_article_meta( $post ) {
|
||||
wp_editor( $post->post_content, 'content' );
|
||||
}
|
||||
|
||||
function sp_event_edit_columns() {
|
||||
function sportspress_event_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Event', 'sportspress' ),
|
||||
@@ -146,10 +146,10 @@ function sp_event_edit_columns() {
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_event_columns', 'sp_event_edit_columns' );
|
||||
add_filter( 'manage_edit-sp_event_columns', 'sportspress_event_edit_columns' );
|
||||
|
||||
function sp_event_edit_sortable_columns( $columns ) {
|
||||
function sportspress_event_edit_sortable_columns( $columns ) {
|
||||
$columns['sp_kickoff'] = 'sp_kickoff';
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_event_sortable_columns', 'sp_event_edit_sortable_columns' );
|
||||
add_filter( 'manage_edit-sp_event_sortable_columns', 'sportspress_event_edit_sortable_columns' );
|
||||
|
||||
@@ -10,7 +10,7 @@ function sportspress_list_post_init() {
|
||||
'public' => true,
|
||||
'hierarchical' => false,
|
||||
'supports' => array( 'title', 'author' ),
|
||||
'register_meta_box_cb' => 'sp_list_meta_init',
|
||||
'register_meta_box_cb' => 'sportspress_list_meta_init',
|
||||
'rewrite' => array( 'slug' => 'list' ),
|
||||
'show_in_menu' => 'edit.php?post_type=sp_player',
|
||||
'capability_type' => 'sp_list'
|
||||
@@ -19,7 +19,7 @@ function sportspress_list_post_init() {
|
||||
}
|
||||
add_action( 'init', 'sportspress_list_post_init' );
|
||||
|
||||
function sp_list_edit_columns() {
|
||||
function sportspress_list_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Title' ),
|
||||
@@ -29,19 +29,19 @@ function sp_list_edit_columns() {
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_list_columns', 'sp_list_edit_columns' );
|
||||
add_filter( 'manage_edit-sp_list_columns', 'sportspress_list_edit_columns' );
|
||||
|
||||
function sp_list_meta_init( $post ) {
|
||||
function sportspress_list_meta_init( $post ) {
|
||||
$players = (array)get_post_meta( $post->ID, 'sp_player', false );
|
||||
|
||||
add_meta_box( 'sp_playerdiv', __( 'Players', 'sportspress' ), 'sp_list_player_meta', 'sp_list', 'side', 'high' );
|
||||
add_meta_box( 'sp_playerdiv', __( 'Players', 'sportspress' ), 'sportspress_list_player_meta', 'sp_list', 'side', 'high' );
|
||||
|
||||
if ( $players && $players != array(0) ):
|
||||
add_meta_box( 'sp_statsdiv', __( 'Player List', 'sportspress' ), 'sp_list_stats_meta', 'sp_list', 'normal', 'high' );
|
||||
add_meta_box( 'sp_statsdiv', __( 'Player List', 'sportspress' ), 'sportspress_list_stats_meta', 'sp_list', 'normal', 'high' );
|
||||
endif;
|
||||
}
|
||||
|
||||
function sp_list_player_meta( $post ) {
|
||||
function sportspress_list_player_meta( $post ) {
|
||||
$season_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 );
|
||||
$team_id = get_post_meta( $post->ID, 'sp_team', true );
|
||||
?>
|
||||
@@ -76,7 +76,7 @@ function sp_list_player_meta( $post ) {
|
||||
sportspress_nonce();
|
||||
}
|
||||
|
||||
function sp_list_stats_meta( $post ) {
|
||||
function sportspress_list_stats_meta( $post ) {
|
||||
|
||||
list( $columns, $data, $placeholders, $merged ) = sportspress_get_list( $post->ID, true );
|
||||
|
||||
|
||||
@@ -12,14 +12,14 @@ function sportspress_outcome_post_init() {
|
||||
'show_in_menu' => false,
|
||||
'hierarchical' => false,
|
||||
'supports' => array( 'title', 'page-attributes' ),
|
||||
'register_meta_box_cb' => 'sp_outcome_meta_init',
|
||||
'register_meta_box_cb' => 'sportspress_outcome_meta_init',
|
||||
'capability_type' => 'sp_config'
|
||||
);
|
||||
register_post_type( 'sp_outcome', $args );
|
||||
}
|
||||
add_action( 'init', 'sportspress_outcome_post_init' );
|
||||
|
||||
function sp_outcome_edit_columns() {
|
||||
function sportspress_outcome_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Label', 'sportspress' ),
|
||||
@@ -27,13 +27,13 @@ function sp_outcome_edit_columns() {
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_outcome_columns', 'sp_outcome_edit_columns' );
|
||||
add_filter( 'manage_edit-sp_outcome_columns', 'sportspress_outcome_edit_columns' );
|
||||
|
||||
function sp_outcome_meta_init() {
|
||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sp_outcome_details_meta', 'sp_outcome', 'normal', 'high' );
|
||||
function sportspress_outcome_meta_init() {
|
||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_outcome_details_meta', 'sp_outcome', 'normal', 'high' );
|
||||
}
|
||||
|
||||
function sp_outcome_details_meta( $post ) {
|
||||
function sportspress_outcome_details_meta( $post ) {
|
||||
?>
|
||||
<p><strong><?php _e( 'Key', 'sportspress' ); ?></strong></p>
|
||||
<p>
|
||||
|
||||
@@ -10,7 +10,7 @@ function sportspress_player_post_init() {
|
||||
'public' => true,
|
||||
'hierarchical' => false,
|
||||
'supports' => array( 'title', 'author', 'thumbnail' ),
|
||||
'register_meta_box_cb' => 'sp_player_meta_init',
|
||||
'register_meta_box_cb' => 'sportspress_player_meta_init',
|
||||
'rewrite' => array( 'slug' => get_option( 'sp_player_slug', 'player' ) ),
|
||||
'menu_icon' => 'dashicons-groups',
|
||||
'capability_type' => 'sp_player',
|
||||
@@ -19,7 +19,7 @@ function sportspress_player_post_init() {
|
||||
}
|
||||
add_action( 'init', 'sportspress_player_post_init' );
|
||||
|
||||
function sp_player_edit_columns() {
|
||||
function sportspress_player_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Name', 'sportspress' ),
|
||||
@@ -29,35 +29,35 @@ function sp_player_edit_columns() {
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_player_columns', 'sp_player_edit_columns' );
|
||||
add_filter( 'manage_edit-sp_player_columns', 'sportspress_player_edit_columns' );
|
||||
|
||||
function sp_player_meta_init( $post ) {
|
||||
function sportspress_player_meta_init( $post ) {
|
||||
$teams = (array)get_post_meta( $post->ID, 'sp_team', false );
|
||||
$leagues = (array)get_the_terms( $post->ID, 'sp_season' );
|
||||
$seasons = (array)get_the_terms( $post->ID, 'sp_season' );
|
||||
|
||||
remove_meta_box( 'submitdiv', 'sp_player', 'side' );
|
||||
add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', 'sp_player', 'side', 'high' );
|
||||
remove_meta_box( 'postimagediv', 'sp_player', 'side' );
|
||||
add_meta_box( 'postimagediv', __( 'Photo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_player', 'side', 'high' );
|
||||
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sp_player_team_meta', 'sp_player', 'side', 'high' );
|
||||
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_player_team_meta', 'sp_player', 'side', 'high' );
|
||||
|
||||
if ( $teams && $teams != array(0) && $leagues && $leagues != array(0) ):
|
||||
add_meta_box( 'sp_statsdiv', __( 'Statistics', 'sportspress' ), 'sp_player_stats_meta', 'sp_player', 'normal', 'high' );
|
||||
if ( $teams && $teams != array(0) && $seasons && is_array( $seasons ) && is_object( $seasons[0] ) ):
|
||||
add_meta_box( 'sp_statsdiv', __( 'Statistics', 'sportspress' ), 'sportspress_player_stats_meta', 'sp_player', 'normal', 'high' );
|
||||
endif;
|
||||
|
||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sp_player_details_meta', 'sp_player', 'normal', 'high' );
|
||||
add_meta_box( 'sp_profilediv', __( 'Profile' ), 'sp_player_profile_meta', 'sp_player', 'normal', 'high' );
|
||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_player_details_meta', 'sp_player', 'normal', 'high' );
|
||||
add_meta_box( 'sp_profilediv', __( 'Profile' ), 'sportspress_player_profile_meta', 'sp_player', 'normal', 'high' );
|
||||
|
||||
}
|
||||
|
||||
function sp_player_team_meta( $post ) {
|
||||
function sportspress_player_team_meta( $post ) {
|
||||
sportspress_post_checklist( $post->ID, 'sp_team' );
|
||||
sportspress_post_adder( 'sp_team' );
|
||||
}
|
||||
|
||||
function sp_player_stats_meta( $post ) {
|
||||
function sportspress_player_stats_meta( $post ) {
|
||||
$team_ids = (array)get_post_meta( $post->ID, 'sp_team', false );
|
||||
$leagues = (array)get_the_terms( $post->ID, 'sp_season' );
|
||||
$seasons = (array)get_the_terms( $post->ID, 'sp_season' );
|
||||
$stats = (array)get_post_meta( $post->ID, 'sp_statistics', true );
|
||||
|
||||
// Equation Operating System
|
||||
@@ -68,7 +68,7 @@ function sp_player_stats_meta( $post ) {
|
||||
|
||||
// Generate array of all league ids
|
||||
$div_ids = array();
|
||||
foreach ( $leagues as $key => $value ):
|
||||
foreach ( $seasons as $key => $value ):
|
||||
if ( is_object( $value ) && property_exists( $value, 'term_id' ) )
|
||||
$div_ids[] = $value->term_id;
|
||||
endforeach;
|
||||
@@ -92,7 +92,7 @@ function sp_player_stats_meta( $post ) {
|
||||
|
||||
$data = array();
|
||||
|
||||
// Get all leagues populated with stats where available
|
||||
// Get all seasons populated with stats where available
|
||||
$data[ $team_id ] = sportspress_array_combine( $div_ids, sportspress_array_value( $stats, $team_id, array() ) );
|
||||
|
||||
// Get equations from statistics variables
|
||||
@@ -185,11 +185,11 @@ function sp_player_stats_meta( $post ) {
|
||||
endforeach;
|
||||
}
|
||||
|
||||
function sp_player_profile_meta( $post ) {
|
||||
function sportspress_player_profile_meta( $post ) {
|
||||
wp_editor( $post->post_content, 'content' );
|
||||
}
|
||||
|
||||
function sp_player_details_meta( $post ) {
|
||||
function sportspress_player_details_meta( $post ) {
|
||||
|
||||
$number = get_post_meta( $post->ID, 'sp_number', true );
|
||||
$details = get_post_meta( $post->ID, 'sp_details', true );
|
||||
|
||||
@@ -12,14 +12,14 @@ function sportspress_result_post_init() {
|
||||
'show_in_menu' => false,
|
||||
'hierarchical' => false,
|
||||
'supports' => array( 'title', 'page-attributes' ),
|
||||
'register_meta_box_cb' => 'sp_result_meta_init',
|
||||
'register_meta_box_cb' => 'sportspress_result_meta_init',
|
||||
'capability_type' => 'sp_config'
|
||||
);
|
||||
register_post_type( 'sp_result', $args );
|
||||
}
|
||||
add_action( 'init', 'sportspress_result_post_init' );
|
||||
|
||||
function sp_result_edit_columns() {
|
||||
function sportspress_result_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Label', 'sportspress' ),
|
||||
@@ -28,13 +28,13 @@ function sp_result_edit_columns() {
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_result_columns', 'sp_result_edit_columns' );
|
||||
add_filter( 'manage_edit-sp_result_columns', 'sportspress_result_edit_columns' );
|
||||
|
||||
function sp_result_meta_init() {
|
||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sp_result_details_meta', 'sp_result', 'normal', 'high' );
|
||||
function sportspress_result_meta_init() {
|
||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_result_details_meta', 'sp_result', 'normal', 'high' );
|
||||
}
|
||||
|
||||
function sp_result_details_meta( $post ) {
|
||||
function sportspress_result_details_meta( $post ) {
|
||||
$formats = sportspress_get_config_formats();
|
||||
?>
|
||||
<p><strong><?php _e( 'Key', 'sportspress' ); ?></strong></p>
|
||||
|
||||
@@ -10,7 +10,7 @@ function sportspress_staff_post_init() {
|
||||
'public' => true,
|
||||
'hierarchical' => false,
|
||||
'supports' => array( 'title', 'author', 'thumbnail' ),
|
||||
'register_meta_box_cb' => 'sp_staff_meta_init',
|
||||
'register_meta_box_cb' => 'sportspress_staff_meta_init',
|
||||
'rewrite' => array( 'slug' => get_option( 'sp_staff_slug', 'staff' ) ),
|
||||
'menu_icon' => 'dashicons-businessman',
|
||||
'capability_type' => 'sp_staff'
|
||||
@@ -19,25 +19,25 @@ function sportspress_staff_post_init() {
|
||||
}
|
||||
add_action( 'init', 'sportspress_staff_post_init' );
|
||||
|
||||
function sp_staff_meta_init() {
|
||||
function sportspress_staff_meta_init() {
|
||||
remove_meta_box( 'submitdiv', 'sp_staff', 'side' );
|
||||
add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', 'sp_staff', 'side', 'high' );
|
||||
remove_meta_box( 'postimagediv', 'sp_staff', 'side' );
|
||||
add_meta_box( 'postimagediv', __( 'Photo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_staff', 'side', 'high' );
|
||||
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sp_staff_team_meta', 'sp_staff', 'side', 'high' );
|
||||
add_meta_box( 'sp_profilediv', __( 'Profile' ), 'sp_staff_profile_meta', 'sp_staff', 'normal', 'high' );
|
||||
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_staff_team_meta', 'sp_staff', 'side', 'high' );
|
||||
add_meta_box( 'sp_profilediv', __( 'Profile' ), 'sportspress_staff_profile_meta', 'sp_staff', 'normal', 'high' );
|
||||
}
|
||||
function sp_staff_team_meta( $post ) {
|
||||
function sportspress_staff_team_meta( $post ) {
|
||||
sportspress_post_checklist( $post->ID, 'sp_team' );
|
||||
sportspress_post_adder( 'sp_team' );
|
||||
sportspress_nonce();
|
||||
}
|
||||
|
||||
function sp_staff_profile_meta( $post ) {
|
||||
function sportspress_staff_profile_meta( $post ) {
|
||||
wp_editor( $post->post_content, 'content' );
|
||||
}
|
||||
|
||||
function sp_staff_edit_columns() {
|
||||
function sportspress_staff_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Name', 'sportspress' ),
|
||||
@@ -47,4 +47,4 @@ function sp_staff_edit_columns() {
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_staff_columns', 'sp_staff_edit_columns' );
|
||||
add_filter( 'manage_edit-sp_staff_columns', 'sportspress_staff_edit_columns' );
|
||||
|
||||
@@ -12,14 +12,14 @@ function sportspress_statistic_post_init() {
|
||||
'show_in_menu' => false,
|
||||
'hierarchical' => false,
|
||||
'supports' => array( 'title', 'page-attributes' ),
|
||||
'register_meta_box_cb' => 'sp_statistic_meta_init',
|
||||
'register_meta_box_cb' => 'sportspress_statistic_meta_init',
|
||||
'capability_type' => 'sp_config'
|
||||
);
|
||||
register_post_type( 'sp_statistic', $args );
|
||||
}
|
||||
add_action( 'init', 'sportspress_statistic_post_init' );
|
||||
|
||||
function sp_statistic_edit_columns() {
|
||||
function sportspress_statistic_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Label', 'sportspress' ),
|
||||
@@ -30,13 +30,13 @@ function sp_statistic_edit_columns() {
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_statistic_columns', 'sp_statistic_edit_columns' );
|
||||
add_filter( 'manage_edit-sp_statistic_columns', 'sportspress_statistic_edit_columns' );
|
||||
|
||||
function sp_statistic_meta_init() {
|
||||
add_meta_box( 'sp_equationdiv', __( 'Details', 'sportspress' ), 'sp_statistic_equation_meta', 'sp_statistic', 'normal', 'high' );
|
||||
function sportspress_statistic_meta_init() {
|
||||
add_meta_box( 'sp_equationdiv', __( 'Details', 'sportspress' ), 'sportspress_statistic_equation_meta', 'sp_statistic', 'normal', 'high' );
|
||||
}
|
||||
|
||||
function sp_statistic_equation_meta( $post ) {
|
||||
function sportspress_statistic_equation_meta( $post ) {
|
||||
$formats = sportspress_get_config_formats();
|
||||
|
||||
$equation = explode( ' ', get_post_meta( $post->ID, 'sp_equation', true ) );
|
||||
|
||||
@@ -10,7 +10,7 @@ function sportspress_table_post_init() {
|
||||
'public' => true,
|
||||
'hierarchical' => false,
|
||||
'supports' => array( 'title', 'author', 'excerpt' ),
|
||||
'register_meta_box_cb' => 'sp_table_meta_init',
|
||||
'register_meta_box_cb' => 'sportspress_table_meta_init',
|
||||
'rewrite' => array( 'slug' => 'table' ),
|
||||
'show_in_menu' => 'edit.php?post_type=sp_team',
|
||||
// 'capability_type' => 'sp_table'
|
||||
@@ -19,7 +19,7 @@ function sportspress_table_post_init() {
|
||||
}
|
||||
add_action( 'init', 'sportspress_table_post_init' );
|
||||
|
||||
function sp_table_edit_columns() {
|
||||
function sportspress_table_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'title' => __( 'Title' ),
|
||||
@@ -28,19 +28,19 @@ function sp_table_edit_columns() {
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_table_columns', 'sp_table_edit_columns' );
|
||||
add_filter( 'manage_edit-sp_table_columns', 'sportspress_table_edit_columns' );
|
||||
|
||||
function sp_table_meta_init( $post ) {
|
||||
function sportspress_table_meta_init( $post ) {
|
||||
$teams = (array)get_post_meta( $post->ID, 'sp_team', false );
|
||||
|
||||
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sp_table_team_meta', 'sp_table', 'side', 'high' );
|
||||
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_table_team_meta', 'sp_table', 'side', 'high' );
|
||||
|
||||
if ( $teams && $teams != array(0) ):
|
||||
add_meta_box( 'sp_columnsdiv', __( 'League Table', 'sportspress' ), 'sp_table_columns_meta', 'sp_table', 'normal', 'high' );
|
||||
add_meta_box( 'sp_columnsdiv', __( 'League Table', 'sportspress' ), 'sportspress_table_columns_meta', 'sp_table', 'normal', 'high' );
|
||||
endif;
|
||||
}
|
||||
|
||||
function sp_table_team_meta( $post, $test ) {
|
||||
function sportspress_table_team_meta( $post, $test ) {
|
||||
$league_id = sportspress_get_the_term_id( $post->ID, 'sp_season', 0 );
|
||||
?>
|
||||
<div>
|
||||
@@ -64,7 +64,7 @@ function sp_table_team_meta( $post, $test ) {
|
||||
sportspress_nonce();
|
||||
}
|
||||
|
||||
function sp_table_columns_meta( $post ) {
|
||||
function sportspress_table_columns_meta( $post ) {
|
||||
|
||||
list( $columns, $data, $placeholders, $merged ) = sportspress_get_table( $post->ID, true );
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ function sportspress_team_post_init() {
|
||||
'public' => true,
|
||||
'hierarchical' => true,
|
||||
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ),
|
||||
'register_meta_box_cb' => 'sp_team_meta_init',
|
||||
'register_meta_box_cb' => 'sportspress_team_meta_init',
|
||||
'rewrite' => array( 'slug' => get_option( 'sp_team_slug', 'team' ) ),
|
||||
'menu_icon' => 'dashicons-shield-alt',
|
||||
'capability_type' => 'sp_team'
|
||||
@@ -19,7 +19,7 @@ function sportspress_team_post_init() {
|
||||
}
|
||||
add_action( 'init', 'sportspress_team_post_init' );
|
||||
|
||||
function sp_team_meta_init( $post ) {
|
||||
function sportspress_team_meta_init( $post ) {
|
||||
$leagues = (array)get_the_terms( $post->ID, 'sp_season' );
|
||||
|
||||
remove_meta_box( 'submitdiv', 'sp_team', 'side' );
|
||||
@@ -28,11 +28,11 @@ function sp_team_meta_init( $post ) {
|
||||
add_meta_box( 'postimagediv', __( 'Logo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_team', 'side', 'high' );
|
||||
|
||||
if ( $leagues && $leagues != array(0) ):
|
||||
add_meta_box( 'sp_columnssdiv', __( 'Table Columns', 'sportspress' ), 'sp_team_columns_meta', 'sp_team', 'normal', 'high' );
|
||||
add_meta_box( 'sp_columnssdiv', __( 'Table Columns', 'sportspress' ), 'sportspress_team_columns_meta', 'sp_team', 'normal', 'high' );
|
||||
endif;
|
||||
}
|
||||
|
||||
function sp_team_edit_columns() {
|
||||
function sportspress_team_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'sp_logo' => ' ',
|
||||
@@ -41,9 +41,9 @@ function sp_team_edit_columns() {
|
||||
);
|
||||
return $columns;
|
||||
}
|
||||
add_filter( 'manage_edit-sp_team_columns', 'sp_team_edit_columns' );
|
||||
add_filter( 'manage_edit-sp_team_columns', 'sportspress_team_edit_columns' );
|
||||
|
||||
function sp_team_columns_meta( $post ) {
|
||||
function sportspress_team_columns_meta( $post ) {
|
||||
$leagues = (array)get_the_terms( $post->ID, 'sp_season' );
|
||||
$columns = (array)get_post_meta( $post->ID, 'sp_columns', true );
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
$data = get_posts( $args );
|
||||
?>
|
||||
<h3 class="title"><?php _e( 'Table Columns', 'sportspress' ); ?></h3>
|
||||
<table class="widefat sp-config-table">
|
||||
<table class="widefat sp-admin-config-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
@@ -46,7 +46,7 @@
|
||||
$data = get_posts( $args );
|
||||
?>
|
||||
<h3 class="title"><?php _e( 'Statistics', 'sportspress' ); ?></h3>
|
||||
<table class="widefat sp-config-table">
|
||||
<table class="widefat sp-admin-config-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
@@ -83,7 +83,7 @@
|
||||
$data = get_posts( $args );
|
||||
?>
|
||||
<h3 class="title"><?php _e( 'Results', 'sportspress' ); ?></h3>
|
||||
<table class="widefat sp-config-table">
|
||||
<table class="widefat sp-admin-config-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
@@ -120,7 +120,7 @@
|
||||
$data = get_posts( $args );
|
||||
?>
|
||||
<h3 class="title"><?php _e( 'Outcomes', 'sportspress' ); ?></h3>
|
||||
<table class="widefat sp-config-table">
|
||||
<table class="widefat sp-admin-config-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php _e( 'Label', 'sportspress' ); ?></th>
|
||||
|
||||
Reference in New Issue
Block a user