I'm creating a Tennis website. I've got 2 custom types : players and tournaments.
I would like to display the result of the finals on the tournaments page and players page. That is to say, on each page of tournament I want to display the name of the finalists (winner and loser) and on each page of player, I want to display the name of the tournaments for wich this certain player was finalist (and display his corresponding opponent). I hope I'm understandable!
With the help of the plugin Posts 2 Posts, I created 2 connections between the players and the tournaments:
p2p_register_connection_type( array(
'name' => 'won_final',
'from' => 'player',
'to' => 'tournament'
) );
and
p2p_register_connection_type( array(
'name' => 'lost_final',
'from' => 'player',
'to' => 'tournament'
) );
I have no idea of what code I can use to find and the display the corresponding opponent of a certain player when I display the tournaments for which the player was finalist.
Any help to put me on a track ? Thanks!