Example code for Geo location Meta fields

Support MB Geolocation Example code for Geo location Meta fieldsResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #16095
    RazibRazib
    Participant

    Is it possible to get example code for Geo location Meta fields?

    #16109
    Anh TranAnh Tran
    Keymaster

    Here you are:

    <?php
    add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) {
        $meta_boxes[] = [
            'title' => 'Test',
            'geo' => [
                'api_key' => 'your_api_key',
            ],
            'fields' => [
                [
                    'id' => 'address',
                    'type' => 'text',
                    'name' => 'Address',
                ],
                [
                    'id' => 'administrative_area_level_1',
                    'type' => 'text',
                    'name' => 'State',
                ],
                [
                    'id' => 'country',
                    'type' => 'text',
                    'name' => 'Country',
                ],
            ],
        ];
        return $meta_boxes;
    } );
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.