meta-box icon indicating copy to clipboard operation
meta-box copied to clipboard

Multiple pins, one map

Open Rayken opened this issue 7 years ago • 0 comments

        $meta_boxes[] = array(
            'title'     => __( 'Google Map', 'your-prefix' ),
            'fields'    => array(
                // Map requires at least one address field (with type = text)
                array(
                    'id'            => 'address',
                    'name'          => __( 'Address', 'your-prefix' ),
                    'type'          => 'text',
                    'std'           => __( 'Hanoi, Vietnam', 'your-prefix' ),
                    'clone'         => true,
                    'add_button'    => '+ Add more interesting locations',
                ),
                
                array(
                    'id'            => 'map',
                    'name'          => __( 'Location', 'your-prefix' ),
                    'type'          => 'map',
                    'region'        => 'sv',
                    
                    // Default location: 'latitude,longitude[,zoom]' (zoom is optional)
                    'std'           => '-6.233406,-35.049906,15',
                    // Name of text field where address is entered. Can be list of text fields, separated by commas (for ex. city, state)
                    'address_field' => 'address',
                    'api_key'       => 'XXXXXXXXXXX', // https://metabox.io/docs/define-fields/#section-map
                ),
            ),
        );

Basically, above doesn't work. It should add a "pin" for each address clone so one could show "interesting areas", say perhaps supermarkets and playgrounds or so. Maybe even so that each can get its own color? Just a thought.

Rayken avatar Oct 06 '17 12:10 Rayken