Custom Fields
Re-Envisioned
Support General I try to get the longitude and latitude but got an error

  • Creator
    Topic
  • #27522
    Resolved info@ceescoenen.nl
    Participant

    I will return the long and lat so I can use the Google Map in Oxygen. What I try... it doesn't work and get errors. The code below I try to echo the values but got an illegal string offset 'latitude' etc.

    <?php
    $location = rwmb_meta( 'map_id', ['object_type' => 'setting'], 'contact' );

    echo $location['latitude'];
    echo $location['longitude'];
    echo $location['zoom'];

    $test = $location['latitude'].','.$location['longitude'];
    echo $test;

    ?>

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #27539
    info@ceescoenen.nl
    Participant

    [Solved]

    <?php
    function get_map() {
    $map_id = get_option('contact');
    $map_objects = explode(",", $map_id['map_id'] );
    $lat = $map_objects[0];
    $long = $map_objects[1];
    return $lat . ',' . $long ;
    }

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.