Hello guys, I have a problem with the placement of markers by latitude and longitude
I use a select handmade because I’m developing for WordPress MU
Exemple:
global $wpdb;
$result_sql .= "
SELECT ID AS id
(SELECT meta_value FROM wp_9_postmeta WHERE post_id = ID AND meta_key = 'gmap') AS gmap
";
and
<?php foreach($wpdb->get_results($result_sql, OBJECT) as $rss) { ?>
$googlemap = $rss->gmap;
$googlemap['lat'];
$googlemap['lng'];
<?php } ?>
But $googlemap[‘lat’]; $googlemap[‘lng’]; return “a“… that is the beginning of the array a:3:{s:7:”address”;s:60:
Could someone help me?
Solved! I use switch_to_blog();
global $wpdb;
$result_sql .= "
SELECT ID AS id
";
switch_to_blog(9);
foreach($wpdb->get_results($result_sql, OBJECT) as $rss) {
$map = get_post_meta($rss->id, 'gmap', true);
$map["lat"];
$map["lng"];
} restore_current_blog();