Fix styles and functions to align with theme
This commit is contained in:
@@ -23,6 +23,9 @@ function sportspress_admin_menu( $position ) {
|
||||
if ( $position ):
|
||||
$menu[ $position ] = array( '', 'read', 'separator-sportspress', '', 'wp-menu-separator sportspress' );
|
||||
endif;
|
||||
|
||||
// Remove "Positions" link from Media submenu
|
||||
unset( $submenu['upload.php'][17] );
|
||||
|
||||
// Remove "Leagues" link from Players submenu
|
||||
unset( $submenu['edit.php?post_type=sp_player'][15] );
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
function sportspress_manage_posts_custom_column( $column, $post_id ) {
|
||||
global $post;
|
||||
switch ( $column ):
|
||||
case 'sp_logo':
|
||||
case 'sp_icon':
|
||||
edit_post_link( get_the_post_thumbnail( $post_id, 'sportspress-icon' ), '', '', $post_id );
|
||||
break;
|
||||
case 'sp_position':
|
||||
|
||||
@@ -5,7 +5,7 @@ function sportspress_sanitize_title( $title ) {
|
||||
|
||||
return $title;
|
||||
|
||||
elseif ( isset( $_POST ) && array_key_exists( 'post_type', $_POST ) && in_array( $_POST['post_type'], array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_statistic' ) ) ):
|
||||
elseif ( isset( $_POST ) && array_key_exists( 'post_type', $_POST ) && in_array( $_POST['post_type'], array( 'sp_result', 'sp_outcome', 'sp_column', 'sp_statistic', 'sp_metric' ) ) ):
|
||||
|
||||
$key = $_POST['sp_key'];
|
||||
|
||||
|
||||
@@ -82,6 +82,25 @@ function sportspress_save_post( $post_id ) {
|
||||
|
||||
break;
|
||||
|
||||
case ( 'sp_metric' ):
|
||||
|
||||
// Update format as string
|
||||
update_post_meta( $post_id, 'sp_format', sportspress_array_value( $_POST, 'sp_format', 'integer' ) );
|
||||
|
||||
// Update precision as integer
|
||||
update_post_meta( $post_id, 'sp_precision', (int) sportspress_array_value( $_POST, 'sp_precision', 1 ) );
|
||||
|
||||
// Update equation as string
|
||||
update_post_meta( $post_id, 'sp_equation', implode( ' ', sportspress_array_value( $_POST, 'sp_equation', array() ) ) );
|
||||
|
||||
// Update sort order as string
|
||||
update_post_meta( $post_id, 'sp_priority', sportspress_array_value( $_POST, 'sp_priority', '0' ) );
|
||||
|
||||
// Update sort order as string
|
||||
update_post_meta( $post_id, 'sp_order', sportspress_array_value( $_POST, 'sp_order', 'DESC' ) );
|
||||
|
||||
break;
|
||||
|
||||
case ( 'sp_result' ):
|
||||
|
||||
// Update format as string
|
||||
@@ -100,6 +119,9 @@ function sportspress_save_post( $post_id ) {
|
||||
// Update player number
|
||||
update_post_meta( $post_id, 'sp_number', sportspress_array_value( $_POST, 'sp_number', '' ) );
|
||||
|
||||
// Update current team
|
||||
update_post_meta( $post_id, 'sp_current_team', sportspress_array_value( $_POST, 'sp_current_team', '' ) );
|
||||
|
||||
// Update nationality
|
||||
update_post_meta( $post_id, 'sp_nationality', sportspress_array_value( $_POST, 'sp_nationality', '' ) );
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ add_action( 'init', 'sportspress_player_post_init' );
|
||||
function sportspress_player_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'sp_icon' => ' ',
|
||||
'title' => __( 'Name', 'sportspress' ),
|
||||
'sp_position' => __( 'Positions', 'sportspress' ),
|
||||
'sp_team' => __( 'Teams', 'sportspress' ),
|
||||
@@ -39,7 +40,7 @@ function sportspress_player_meta_init( $post ) {
|
||||
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( 'postimagediv', __( 'Photo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_player', 'side', 'low' );
|
||||
add_meta_box( 'sp_detailsdiv', __( 'Details', 'sportspress' ), 'sportspress_player_details_meta', 'sp_player', 'side', 'high' );
|
||||
add_meta_box( 'sp_teamdiv', __( 'Teams', 'sportspress' ), 'sportspress_player_team_meta', 'sp_player', 'side', 'high' );
|
||||
|
||||
@@ -64,6 +65,8 @@ function sportspress_player_details_meta( $post ) {
|
||||
|
||||
$number = get_post_meta( $post->ID, 'sp_number', true );
|
||||
$nationality = get_post_meta( $post->ID, 'sp_nationality', true );
|
||||
$teams = array_filter( get_post_meta( $post->ID, 'sp_team', false ) );
|
||||
$current_team = get_post_meta( $post->ID, 'sp_current_team', true );
|
||||
?>
|
||||
<p>
|
||||
<strong><?php _e( 'Number', 'sportspress' ); ?></strong>
|
||||
@@ -87,6 +90,20 @@ function sportspress_player_details_meta( $post ) {
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</p>
|
||||
<?php if ( $teams ): ?>
|
||||
<p>
|
||||
<strong><?php _e( 'Current Team', 'sportspress' ); ?></strong>
|
||||
</p>
|
||||
<p>
|
||||
<select id="sp_current_team" name="sp_current_team">
|
||||
<?php foreach ( $teams as $team ): ?>
|
||||
<option value="<?php echo $team; ?>" <?php selected ( $current_team, $team ); ?>>
|
||||
<?php echo get_the_title( $team ); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ 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( 'postimagediv', __( 'Photo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_staff', 'side', 'low' );
|
||||
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' );
|
||||
}
|
||||
@@ -40,6 +40,7 @@ function sportspress_staff_profile_meta( $post ) {
|
||||
function sportspress_staff_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'sp_icon' => ' ',
|
||||
'title' => __( 'Name', 'sportspress' ),
|
||||
'sp_position' => __( 'Positions', 'sportspress' ),
|
||||
'sp_team' => __( 'Teams', 'sportspress' ),
|
||||
|
||||
@@ -26,7 +26,7 @@ function sportspress_team_meta_init( $post ) {
|
||||
remove_meta_box( 'submitdiv', 'sp_team', 'side' );
|
||||
add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', 'sp_team', 'side', 'high' );
|
||||
remove_meta_box( 'postimagediv', 'sp_team', 'side' );
|
||||
add_meta_box( 'postimagediv', __( 'Logo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_team', 'side', 'high' );
|
||||
add_meta_box( 'postimagediv', __( 'Logo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_team', 'side', 'low' );
|
||||
|
||||
if ( $leagues && $seasons ):
|
||||
add_meta_box( 'sp_columnssdiv', __( 'Table Columns', 'sportspress' ), 'sportspress_team_columns_meta', 'sp_team', 'normal', 'high' );
|
||||
@@ -36,7 +36,7 @@ function sportspress_team_meta_init( $post ) {
|
||||
function sportspress_team_edit_columns() {
|
||||
$columns = array(
|
||||
'cb' => '<input type="checkbox" />',
|
||||
'sp_logo' => ' ',
|
||||
'sp_icon' => ' ',
|
||||
'title' => __( 'Team', 'sportspress' ),
|
||||
'sp_league' => __( 'Leagues', 'sportspress' ),
|
||||
'sp_season' => __( 'Seasons', 'sportspress' ),
|
||||
|
||||
@@ -3,7 +3,7 @@ function sportspress_position_term_init() {
|
||||
$name = __( 'Positions', 'sportspress' );
|
||||
$singular_name = __( 'Position', 'sportspress' );
|
||||
$lowercase_name = __( 'position', 'sportspress' );
|
||||
$object_type = array( 'sp_player' );
|
||||
$object_type = array( 'sp_player', 'attachment' );
|
||||
$labels = sportspress_get_term_labels( $name, $singular_name, $lowercase_name );
|
||||
$args = array(
|
||||
'label' => $name,
|
||||
@@ -14,5 +14,6 @@ function sportspress_position_term_init() {
|
||||
);
|
||||
register_taxonomy( 'sp_position', $object_type, $args );
|
||||
register_taxonomy_for_object_type( 'sp_position', 'sp_player' );
|
||||
register_taxonomy_for_object_type( 'sp_position', 'attachment' );
|
||||
}
|
||||
add_action( 'init', 'sportspress_position_term_init' );
|
||||
|
||||
Reference in New Issue
Block a user