#12920

Garth John
Participant

This is how I’ve written my code for the meta boxes. with each $meta_boxes[] = array() adding a field to whichever post I have set it to. I have added many fields so I just took the start and finish of the code with one of the items I have added.

<?php  
    function add_meta_fields( $meta_boxes ) {
        $meta_boxes[] = array(
            'id' => 'area',
            'title' => 'Area' ,
            'post_types' => array( 'for_sale',' ' ),
            'context' => 'normal',
            'autosave' => false,

            'fields' => array(
                array(
                'id' => 'address',
                'name' => 'Address',
                'type' => 'text',
                ),
                array(
                    'id' => 'map',
                    'name' => 'Location',
                    'type' => 'map',
                    // Default location: 'latitude,longitude[,zoom]' (zoom is optional)
                    'std' => '-6.233406,-35.049906,15',
                    // Address field ID
                    'address_field' => 'address',
                    // Google API key
                    'api_key' => 'MY_API_KEY_IS_INSERTED_HERE',
                ),
            ),
        );
        return $meta_boxes;
        }
    add_filter( 'rwmb_meta_boxes', 'add_meta_fields' );
?>