I try to get the longitude and latitude but got an error

Support General I try to get the longitude and latitude but got an errorResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #27522
    info@ceescoenen.nl[email protected]
    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;

    ?>

    #27539
    info@ceescoenen.nl[email protected]
    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 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.