Advertisement
longnguyenwp

Geolocation

Feb 9th, 2021
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.27 KB | None | 0 0
  1. <?php
  2. add_filter('rwmb_meta_boxes', function ($meta_boxes) {
  3.     $meta_boxes[] = [
  4.         'id'     => 'geolocation6',
  5.         'title'  => 'GeoLocation6',
  6.         'post_types' => 'page',
  7.         'geo'    => true,
  8.         'fields' => [
  9.             [
  10.                 // In cloneable groups.
  11.                 'type'   => 'group',
  12.                 'name'   => 'Locations',
  13.                 'id'     => 'g',
  14.                 'clone'  => true,
  15.                 'fields' => [
  16.                     [
  17.                         'type' => 'text',
  18.                         'name' => 'Address',
  19.                         'id'   => 'address6',
  20.                     ],
  21.                     [
  22.                         'type'          => 'text',
  23.                         'name'          => 'City',
  24.                         'id'            => 'city',
  25.                         'address_field' => 'address6',
  26.                     ],
  27.                     [
  28.                         'type'          => 'text',
  29.                         'name'          => 'Country',
  30.                         'id'            => 'country',
  31.                         'address_field' => 'address6',
  32.                     ],
  33.                     [
  34.                         'type'          => 'text',
  35.                         'name'          => 'Latitude',
  36.                         'id'            => 'lat',
  37.                         'address_field' => 'address6',
  38.                     ],
  39.                     [
  40.                         'type'          => 'text',
  41.                         'name'          => 'Longitude',
  42.                         'id'            => 'lng',
  43.                         'address_field' => 'address6',
  44.                     ],
  45.                     [
  46.                         'id'            => 'map',
  47.                         'type'          => 'map',
  48.                         'name'          => 'Map',
  49.                         'address_field' => 'address6',
  50.                         'language'      => 'en',
  51.                         'api_key'       => 'AIzaSyB5M3fZicGMrv2yntQmk1gPVRXn3SQaZ9g',
  52.                     ],
  53.                 ],
  54.             ],
  55.  
  56.             // Another group of fields in the same meta box.
  57.             [
  58.                 'type' => 'text',
  59.                 'name' => 'Address7',
  60.                 'id'   => 'address7',
  61.             ],
  62.             [
  63.                 'type'          => 'text',
  64.                 'name'          => 'City7',
  65.                 'id'            => 'city7',
  66.                 'binding'       => 'city',
  67.                 'address_field' => 'address7'
  68.             ],
  69.             [
  70.                 'type'          => 'text',
  71.                 'name'          => 'Latitude7',
  72.                 'id'            => 'lat7',
  73.                 'binding'       => 'lat',
  74.                 'address_field' => 'address7',
  75.             ],
  76.             [
  77.                 'type'          => 'text',
  78.                 'name'          => 'Longitude7',
  79.                 'id'            => 'lng7',
  80.                 'binding'       => 'lng',
  81.                 'address_field' => 'address7',
  82.             ],
  83.             [
  84.                 'id'            => 'map7',
  85.                 'type'          => 'map',
  86.                 'name'          => 'Map7',
  87.                 'language'      => 'en',
  88.                 'address_field' => 'address7',
  89.                 'api_key'       => 'AIzaSyB5M3fZicGMrv2yntQmk1gPVRXn3SQaZ9g',
  90.             ],
  91.             [
  92.                 'id'      => 'non_binding8',
  93.                 'type'    => 'select',
  94.                 'name'    => 'Non binding field',
  95.                 'options' => [
  96.                     'a' => 'A',
  97.                     'b' => 'B',
  98.                 ],
  99.             ],
  100.         ],
  101.     ];
  102.  
  103.     $meta_boxes[] = [
  104.         'id'     => 'geolocation9',
  105.         'title'  => 'GeoLocation9',
  106.         'geo'    => true,
  107.         'fields' => [
  108.             [
  109.                 'type' => 'text',
  110.                 'name' => 'Address9',
  111.                 'id'   => 'address9',
  112.             ],
  113.             [
  114.                 'type'          => 'text',
  115.                 'name'          => 'Latitude9',
  116.                 'id'            => 'lat9',
  117.                 'binding'       => 'lat',
  118.                 'address_field' => 'address9',
  119.             ],
  120.             [
  121.                 'type'          => 'text',
  122.                 'name'          => 'Longitude9',
  123.                 'id'            => 'lng9',
  124.                 'binding'       => 'lng',
  125.                 'address_field' => 'address9',
  126.             ],
  127.             [
  128.                 'id'            => 'map9',
  129.                 'type'          => 'map',
  130.                 'name'          => 'Map9',
  131.                 'language'      => 'en',
  132.                 'address_field' => 'address9',
  133.                 'api_key'       => 'AIzaSyB5M3fZicGMrv2yntQmk1gPVRXn3SQaZ9g',
  134.             ],
  135.         ],
  136.     ];
  137.  
  138.     return $meta_boxes;
  139. } );
  140.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement