• Resolved UltimateBoss

    (@ultimateboss)


    Hi,

    I have a test site in development at the moment. I want to display all players from all child teams with stats added together.

    For Instance, lets say the team is Tigers, I have Tigers ‘A’ and Tigers ‘B’ as child teams to the Tigers parent team. However, on the player list section, I want a list that displays all players from both Tigers child teams, as players interchange between teams and want the stats from both to be added together.

    At present, player lists can be only be selected from either, Tigers, Tigers ‘A’ and Tigers ‘B’ and not as collective.

    Is this possible?

    Thanks.

Viewing 1 replies (of 1 total)
  • Plugin Contributor Savvas

    (@savvasha)

    Hi @ultimateboss,

    What you can try is to copy /plugins/sportspress/templates/player-list.php to /themes/your-child-theme/sportrspress/ folder and just before line 65 ($data = apply_filters( 'sportspress_player_list_data', $list->data( false, $leagues, $seasons, $team ), $id );) add something like the following:

    $team = (int) get_post_meta( $id, 'sp_team', true );
    $team = get_children( [	'post_parent' 	=> $team,
    			'fields'        => 'ids',
    		       ] );

    Be aware that the above will be effective to ALL your player lists. So you may want to check that it will effect only specific player lists based on their post_id.

    Thanks,
    Savvas

Viewing 1 replies (of 1 total)
  • The topic ‘Player List: Include All Players from Child Teams’ is closed to new replies.