Add league taxonomy
This commit is contained in:
@@ -24,11 +24,17 @@ function sportspress_admin_menu( $position ) {
|
||||
$menu[ $position ] = array( '', 'read', 'separator-sportspress', '', 'wp-menu-separator sportspress' );
|
||||
endif;
|
||||
|
||||
// Remove "Seasons" link from Players submenu
|
||||
// Remove "Leagues" link from Players submenu
|
||||
unset( $submenu['edit.php?post_type=sp_player'][15] );
|
||||
|
||||
// Remove "Seasons" link from Staff submenu
|
||||
// Remove "Seasons" link from Players submenu
|
||||
unset( $submenu['edit.php?post_type=sp_player'][16] );
|
||||
|
||||
// Remove "Leagues" link from Staff submenu
|
||||
unset( $submenu['edit.php?post_type=sp_staff'][15] );
|
||||
|
||||
// Remove "Seasons" link from Staff submenu
|
||||
unset( $submenu['edit.php?post_type=sp_staff'][16] );
|
||||
|
||||
}
|
||||
add_action( 'admin_menu', 'sportspress_admin_menu' );
|
||||
add_action( 'admin_menu', 'sportspress_admin_menu' );
|
||||
|
||||
@@ -69,6 +69,9 @@ function sportspress_manage_posts_custom_column( $column, $post_id ) {
|
||||
case 'sp_event':
|
||||
echo get_post_meta ( $post_id, 'sp_event' ) ? sizeof( get_post_meta ( $post_id, 'sp_event' ) ) : '—';
|
||||
break;
|
||||
case 'sp_league':
|
||||
echo get_the_terms ( $post_id, 'sp_league' ) ? the_terms( $post_id, 'sp_league' ) : '—';
|
||||
break;
|
||||
case 'sp_season':
|
||||
echo get_the_terms ( $post_id, 'sp_season' ) ? the_terms( $post_id, 'sp_season' ) : '—';
|
||||
break;
|
||||
|
||||
@@ -32,6 +32,9 @@ function sportspress_save_post( $post_id ) {
|
||||
// Update staff array
|
||||
sportspress_update_post_meta_recursive( $post_id, 'sp_staff', sportspress_array_value( $_POST, 'sp_staff', array() ) );
|
||||
|
||||
// Update league taxonomy
|
||||
wp_set_post_terms( $post_id, sportspress_array_value( $_POST, 'sp_league', 0 ), 'sp_league' );
|
||||
|
||||
// Update season taxonomy
|
||||
wp_set_post_terms( $post_id, sportspress_array_value( $_POST, 'sp_season', 0 ), 'sp_season' );
|
||||
|
||||
@@ -113,6 +116,9 @@ function sportspress_save_post( $post_id ) {
|
||||
// Update teams array
|
||||
update_post_meta( $post_id, 'sp_teams', sportspress_array_value( $_POST, 'sp_teams', array() ) );
|
||||
|
||||
// Update league taxonomy
|
||||
wp_set_post_terms( $post_id, sportspress_array_value( $_POST, 'sp_league', 0 ), 'sp_league' );
|
||||
|
||||
// Update season taxonomy
|
||||
wp_set_post_terms( $post_id, sportspress_array_value( $_POST, 'sp_season', 0 ), 'sp_season' );
|
||||
|
||||
@@ -129,6 +135,9 @@ function sportspress_save_post( $post_id ) {
|
||||
// Update team array
|
||||
update_post_meta( $post_id, 'sp_team', sportspress_array_value( $_POST, 'sp_team', array() ) );
|
||||
|
||||
// Update league taxonomy
|
||||
wp_set_post_terms( $post_id, sportspress_array_value( $_POST, 'sp_league', 0 ), 'sp_league' );
|
||||
|
||||
// Update season taxonomy
|
||||
wp_set_post_terms( $post_id, sportspress_array_value( $_POST, 'sp_season', 0 ), 'sp_season' );
|
||||
|
||||
|
||||
@@ -1,10 +1,30 @@
|
||||
<?php
|
||||
function sportspress_the_content( $content ) {
|
||||
if ( is_singular( 'sp_team' ) && in_the_loop() ):
|
||||
|
||||
if ( is_singular( 'sp_event' ) && in_the_loop() ):
|
||||
|
||||
global $post;
|
||||
|
||||
// Display event details
|
||||
$content = sportspress_event_details( $post->ID ) . $content;
|
||||
|
||||
elseif ( is_singular( 'sp_calendar' ) && in_the_loop() ):
|
||||
|
||||
global $post;
|
||||
|
||||
// Display events calendar
|
||||
$content = sportspress_events_calendar( $post->ID ) . $content;
|
||||
|
||||
elseif ( is_singular( 'sp_team' ) && in_the_loop() ):
|
||||
|
||||
global $post;
|
||||
|
||||
// Display team columns
|
||||
$content = sportspress_team_columns( $post->ID ) . $content;
|
||||
|
||||
elseif ( is_singular( 'sp_table' ) && in_the_loop() ):
|
||||
|
||||
global $post;
|
||||
global $post;
|
||||
|
||||
// Display league table
|
||||
$content = sportspress_league_table( $post->ID ) . $content;
|
||||
@@ -21,7 +41,7 @@ function sportspress_the_content( $content ) {
|
||||
|
||||
global $post;
|
||||
|
||||
// Display player list
|
||||
// Display player metrics and statistics
|
||||
$content = sportspress_player_metrics( $post->ID ) . sportspress_player_statistics( $post->ID ) . $content;
|
||||
|
||||
endif;
|
||||
|
||||
Reference in New Issue
Block a user