diff --git a/actions.php b/actions.php
index 488ba31c..d9705156 100644
--- a/actions.php
+++ b/actions.php
@@ -1,12 +1,29 @@
$value ):
+ if ( is_array( $value ) )
+ $value = serialize( $value );
+ update_post_meta( $post_id, $key, $value );
+ endforeach;
+ endif;
+ endif;
+}
+add_action( 'save_post', 'sp_save_post' );
?>
\ No newline at end of file
diff --git a/calendar.php b/calendar.php
index b63aaed2..7c2da112 100644
--- a/calendar.php
+++ b/calendar.php
@@ -9,7 +9,7 @@ function sp_calendar_cpt_init() {
'public' => true,
'hierarchical' => false,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ),
- 'rewrite' => array( 'slug' => 'calendar' ),
+ 'rewrite' => array( 'slug' => 'calendar' )
);
register_post_type( 'sp_calendar', $args );
}
@@ -20,8 +20,8 @@ function sp_calendar_edit_columns( $columns ) {
'cb' => '',
'title' => __( 'Title' ),
'sp_team' => __( 'Teams', 'sportspress' ),
- 'sp_league' => __( 'League', 'sportspress' ),
- 'sp_season' => __( 'Season', 'sportspress' ),
+ 'sp_league' => __( 'Leagues', 'sportspress' ),
+ 'sp_season' => __( 'Seasons', 'sportspress' )
);
return $columns;
}
diff --git a/event.php b/event.php
index 8cb2e7f4..9cb19902 100644
--- a/event.php
+++ b/event.php
@@ -187,27 +187,14 @@ function sp_event_article_meta( $post, $metabox ) {
wp_editor( $post->post_content, 'content' );
}
-function sp_event_save() {
- global $post, $post_id, $typenow;
- if ( $typenow == 'sp_event' && isset( $_POST ) ) {
- if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return $post_id;
- if ( ! isset( $_POST['sp_event_team_nonce'] ) || ! wp_verify_nonce( $_POST['sp_event_team_nonce'], plugin_basename( __FILE__ ) ) ) return $post_id;
- $sportspress = (array)$_POST['sportspress'];
- foreach ( $sportspress as $key => $value ):
- update_post_meta( $post_id, $key, $value );
- endforeach;
- }
-}
-add_action( 'save_post', 'sp_event_save' );
-
function sp_event_edit_columns( $columns ) {
$columns = array(
'cb' => '',
'title' => __( 'Event', 'sportspress' ),
'sp_team' => __( 'Teams', 'sportspress' ),
- 'sp_league' => __( 'League', 'sportspress' ),
- 'sp_season' => __( 'Season', 'sportspress' ),
- 'sp_sponsor' => __( 'Sponsor', 'sportspress' ),
+ 'sp_league' => __( 'Leagues', 'sportspress' ),
+ 'sp_season' => __( 'Seasons', 'sportspress' ),
+ 'sp_sponsor' => __( 'Sponsors', 'sportspress' ),
'sp_kickoff' => __( 'Kick-off', 'sportspress' )
);
return $columns;
@@ -223,9 +210,9 @@ function sp_event_custom_columns( $column, $post_id ) {
for ( $i = 1; $i <= $limit; $i++ ):
$team = get_post_meta( $post_id, 'sp_team_' . $i, true );
$parents = get_post_ancestors( $team );
- foreach ( $parents as $parent ) {
+ foreach ( $parents as $parent ):
edit_post_link( get_the_title( $parent ), '', ' — ', $parent );
- }
+ endforeach;
edit_post_link( get_the_title( $team ), '', '
', $team );
endfor;
break;
diff --git a/helpers.php b/helpers.php
index 3d19e27b..9dbbaaa4 100644
--- a/helpers.php
+++ b/helpers.php
@@ -83,4 +83,15 @@ if ( ! function_exists( 'sp_team_logo' ) ) {
endif;
}
}
+
+if ( ! function_exists( 'sp_get_teams' ) ) {
+ function sp_get_teams( $post_id = null ) {
+ $teams = get_post_meta( $post_id, 'sp_teams', true );
+ if ( isset( $teams ) && $teams )
+ $teams = (array)unserialize( $teams );
+ else
+ $teams = array();
+ return $teams;
+ }
+}
?>
\ No newline at end of file
diff --git a/images/menu.png b/images/menu.png
index da3ac766..0e8ada09 100644
Binary files a/images/menu.png and b/images/menu.png differ
diff --git a/player.php b/player.php
index e1202334..aaaf1d57 100644
--- a/player.php
+++ b/player.php
@@ -8,41 +8,102 @@ function sp_player_cpt_init() {
'labels' => $labels,
'public' => true,
'hierarchical' => false,
- 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ),
- 'rewrite' => array( 'slug' => 'player' ),
+ 'supports' => array( 'title', 'author', 'thumbnail', 'page-attributes' ),
+ 'register_meta_box_cb' => 'sp_player_meta_init',
+ 'rewrite' => array( 'slug' => 'player' )
);
register_post_type( 'sp_player', $args );
}
add_action( 'init', 'sp_player_cpt_init' );
+function sp_player_meta_init() {
+ add_meta_box( 'sp_playerdiv', __( 'Player', 'sportspress' ), 'sp_player_basic_meta', 'sp_player', 'side', 'high' );
+ add_meta_box( 'sp_profilediv', __( 'Profile', 'sportspress' ), 'sp_player_profile_meta', 'sp_player', 'normal', 'high' );
+}
+function sp_player_basic_meta( $post, $metabox ) {
+ global $post_id;
+ ?>
+
+
+
+ ';
+}
+
+function sp_player_profile_meta( $post, $metabox ) {
+ wp_editor( $post->post_content, 'content' );
+}
+
function sp_player_edit_columns( $columns ) {
$columns = array(
'cb' => '',
- 'sp_icon' => ' ',
'title' => __( 'Name', 'sportspress' ),
- 'sp_position' => __( 'Position', 'sportspress' ),
- 'sp_team' => __( 'Team', 'sportspress' ),
- 'sp_league' => __( 'League', 'sportspress' ),
- 'sp_season' => __( 'Season', 'sportspress' ),
- 'sp_sponsor' => __( 'Sponsor', 'sportspress' ),
+ 'sp_position' => __( 'Positions', 'sportspress' ),
+ 'sp_team' => __( 'Teams', 'sportspress' ),
+ 'sp_league' => __( 'Leagues', 'sportspress' ),
+ 'sp_season' => __( 'Seasons', 'sportspress' ),
+ 'sp_sponsor' => __( 'Sponsors', 'sportspress' )
);
return $columns;
}
add_filter( 'manage_edit-sp_player_columns', 'sp_player_edit_columns' );
-function sp_player_custom_columns( $column ) {
- global $post, $post_id, $typenow;
+function sp_player_custom_columns( $column, $post_id ) {
+ global $post, $typenow;
if ( $typenow == 'sp_player' ):
switch ($column):
- case 'sp_icon':
- if ( has_post_thumbnail() ) the_post_thumbnail( 'sp_icon' );
- break;
case 'sp_position':
if ( get_the_terms ( $post_id, 'sp_position' ) )
the_terms( $post_id, 'sp_position' );
else
echo '—';
break;
+ case 'sp_team':
+ $teams = sp_get_teams( $post_id );
+ foreach ( $teams as $team ):
+ $parents = get_post_ancestors( $team );
+ $parents = array_combine( array_keys( $parents ), array_reverse( array_values( $parents ) ) );
+ foreach ( $parents as $parent ):
+ if ( !in_array( $parent, $teams ) )
+ edit_post_link( get_the_title( $parent ), '', ' ', $parent );
+ echo '— ';
+ endforeach;
+ edit_post_link( get_the_title( $team ), '', '
', $team );
+ endforeach;
+ break;
case 'sp_league':
if ( get_the_terms ( $post_id, 'sp_league' ) )
the_terms( $post_id, 'sp_league' );
@@ -64,7 +125,7 @@ function sp_player_custom_columns( $column ) {
endswitch;
endif;
}
-add_action( 'manage_posts_custom_column', 'sp_player_custom_columns' );
+add_action( 'manage_posts_custom_column', 'sp_player_custom_columns', 10, 2 );
function sp_player_request_filter_dropdowns() {
global $typenow, $wp_query;
diff --git a/sportspress-admin.css b/sportspress-admin.css
index c93fb761..f920e4f2 100644
--- a/sportspress-admin.css
+++ b/sportspress-admin.css
@@ -91,7 +91,8 @@
#sp_kickoffdiv #timestampdiv p {
display: none;
}
-#sp_articlediv .wp-editor-container {
+#sp_articlediv .wp-editor-container,
+#sp_profilediv .wp-editor-container {
background-color:#fff;
}
.widefat th.column-sp_icon,
diff --git a/staff.php b/staff.php
index 880a6df5..515fb9c4 100644
--- a/staff.php
+++ b/staff.php
@@ -9,7 +9,7 @@ function sp_staff_cpt_init() {
'public' => true,
'hierarchical' => false,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ),
- 'rewrite' => array( 'slug' => 'staff' ),
+ 'rewrite' => array( 'slug' => 'staff' )
);
register_post_type( 'sp_staff', $args );
}
@@ -18,12 +18,11 @@ add_action( 'init', 'sp_staff_cpt_init' );
function sp_staff_edit_columns( $columns ) {
$columns = array(
'cb' => '',
- 'sp_icon' => ' ',
'title' => __( 'Name', 'sportspress' ),
- 'sp_team' => __( 'Team', 'sportspress' ),
- 'sp_position' => __( 'Position', 'sportspress' ),
- 'sp_league' => __( 'League', 'sportspress' ),
- 'sp_season' => __( 'Season', 'sportspress' ),
+ 'sp_team' => __( 'Teams', 'sportspress' ),
+ 'sp_position' => __( 'Positions', 'sportspress' ),
+ 'sp_league' => __( 'Leagues', 'sportspress' ),
+ 'sp_season' => __( 'Seasons', 'sportspress' )
);
return $columns;
}
@@ -33,9 +32,6 @@ function sp_staff_custom_columns( $column ) {
global $post, $post_id, $typenow;
if ( $typenow == 'sp_staff' ):
switch ($column):
- case 'sp_icon':
- if ( has_post_thumbnail() ) the_post_thumbnail( 'sp_icon' );
- break;
case 'sp_position':
if ( get_the_terms ( $post_id, 'sp_position' ) )
the_terms( $post_id, 'sp_position' );
diff --git a/table.php b/table.php
index d29f2a6a..2db28541 100644
--- a/table.php
+++ b/table.php
@@ -9,7 +9,7 @@ function sp_table_cpt_init() {
'public' => true,
'hierarchical' => false,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ),
- 'rewrite' => array( 'slug' => 'table' ),
+ 'rewrite' => array( 'slug' => 'table' )
);
register_post_type( 'sp_table', $args );
}
@@ -20,8 +20,8 @@ function sp_table_edit_columns( $columns ) {
'cb' => '',
'title' => __( 'Title' ),
'sp_team' => __( 'Teams', 'sportspress' ),
- 'sp_league' => __( 'League', 'sportspress' ),
- 'sp_season' => __( 'Season', 'sportspress' ),
+ 'sp_league' => __( 'Leagues', 'sportspress' ),
+ 'sp_season' => __( 'Seasons', 'sportspress' )
);
return $columns;
}
diff --git a/team.php b/team.php
index 96310545..cbb2f5cd 100644
--- a/team.php
+++ b/team.php
@@ -10,7 +10,7 @@ function sp_team_cpt_init() {
'hierarchical' => true,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ),
'register_meta_box_cb' => 'sp_team_meta_init',
- 'rewrite' => array( 'slug' => 'team' ),
+ 'rewrite' => array( 'slug' => 'team' )
);
register_post_type( 'sp_team', $args );
}
@@ -39,8 +39,6 @@ add_filter( 'gettext', 'sp_team_text_replace', 20, 3 );
function sp_team_meta_init() {
remove_meta_box( 'postimagediv', 'sp_team', 'side' );
add_meta_box( 'postimagediv', __( 'Logo', 'sportspress' ), 'post_thumbnail_meta_box', 'sp_team', 'side', 'high' );
- remove_meta_box( 'pageparentdiv', 'sp_team', 'side' );
- add_meta_box( 'pageparentdiv', __( 'Team', 'sportspress' ), 'page_attributes_meta_box', 'sp_team', 'side', 'high' );
}
function sp_team_edit_columns($columns) {
@@ -48,9 +46,9 @@ function sp_team_edit_columns($columns) {
'cb' => '',
'sp_icon' => ' ',
'title' => __( 'Team', 'sportspress' ),
- 'sp_league' => __( 'League', 'sportspress' ),
- 'sp_season' => __( 'Season', 'sportspress' ),
- 'sp_sponsor' => __( 'Sponsor', 'sportspress' ),
+ 'sp_league' => __( 'Leagues', 'sportspress' ),
+ 'sp_season' => __( 'Seasons', 'sportspress' ),
+ 'sp_sponsor' => __( 'Sponsors', 'sportspress' )
);
return $columns;
}
diff --git a/tournament.php b/tournament.php
index 9f602e57..e8b34767 100644
--- a/tournament.php
+++ b/tournament.php
@@ -9,7 +9,7 @@ function sp_tournament_cpt_init() {
'public' => true,
'hierarchical' => true,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'comments', 'page-attributes' ),
- 'rewrite' => array( 'slug' => 'tournament' ),
+ 'rewrite' => array( 'slug' => 'tournament' )
);
register_post_type( 'sp_tournament', $args );
}
@@ -21,7 +21,7 @@ function sp_tournament_edit_columns( $columns ) {
'title' => __( 'Title' ),
'sp_team' => __( 'Teams', 'sportspress' ),
'sp_event' => __( 'Events', 'sportspress' ),
- 'sp_sponsor' => __( 'Sponsor', 'sportspress' ),
+ 'sp_sponsor' => __( 'Sponsor', 'sportspress' )
);
return $columns;
}
diff --git a/venue.php b/venue.php
index 3458e8a3..1db97d77 100644
--- a/venue.php
+++ b/venue.php
@@ -9,7 +9,7 @@ function sp_venue_cpt_init() {
'public' => true,
'hierarchical' => true,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes' ),
- 'rewrite' => array( 'slug' => 'venue' ),
+ 'rewrite' => array( 'slug' => 'venue' )
);
register_post_type( 'sp_venue', $args );
}
@@ -20,7 +20,7 @@ function sp_venue_edit_columns( $columns ) {
'cb' => '',
'title' => __( 'Venue', 'sportspress' ),
'sp_address' => __( 'Address', 'sportspress' ),
- 'sp_sponsor' => __( 'Sponsor', 'sportspress' ),
+ 'sp_sponsor' => __( 'Sponsors', 'sportspress' )
);
return $columns;
}