Custom Fields
Re-Envisioned
Support Meta Box Conditional Logic build custom meta boxes for soccer matches Reply To: build custom meta boxes for soccer matches

#14100

Anh Tran
Keymaster

Hi Sadiq,

Please try to follow these steps:

  1. Create a new custom post type for teams, you can use MB Custom Post Type to do this.
  2. Create a meta box like this:
add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) {
    $meta_boxes[] = [
        'title' => 'Matches',
        'fields' => [
            [
                'id' => 'matches',
                'type' => 'group',
                'clone' => true,
                'collapsible' => true,
                'fields' => [
                    [
                        'id' => 'league',
                        'name' => 'League',
                        'type' => 'text',
                    ],
                    [
                        'id' => 'team1',
                        'name' => 'Team 1',
                        'type' => 'post',
                        'post_type' => 'team',
                    ],
                    [

                        'id' => 'team2',
                        'name' => 'Team 2',
                        'type' => 'post',
                        'post_type' => 'team',
                    ],
                ],
            ],
        ],
    ];
} );

PS: Please take the code as a starter point and try to follow the docs for Meta Box and Meta Box Group. As you’re the one who knows what you want exactly, you should do the code. I can just only help, but can’t do that for you.