Latest News

Test Plug Ins

'' . __('Settings', 'General') . '');

$actions = array_merge($settings, $actions);

}

return $actions;
}

// Map
function mm_map(){

wp_enqueue_script( 'maps-api' );
wp_enqueue_script( 'init-script' );

$map_settings = get_option('mm_plugin_settings');

if (isset($map_settings['scroll'])){
$scroll = true;
} else {
$scroll = false;
}

if (isset($map_settings['controls'])){
$controls = true;
} else {
$controls = false;
}

$map_options = array();
array_push( $map_options, [ $map_settings['zoom'], $scroll, $controls, $map_settings['styles'] ] );

$locations_a = array();

$args = array(
'post_type' => 'mm',
'post_status' => 'publish',
'posts_per_page' => -1
);
$loop = new WP_Query( $args );

while ( $loop->have_posts() ) : $loop->the_post();

$mm_title = get_the_title();

$the_post_id = get_the_ID();

$mm_longitude = get_post_meta(get_the_ID(), 'mm_longitude', true);
$mm_latitude = get_post_meta(get_the_ID(), 'mm_latitude', true);

$mm_address = get_post_meta(get_the_ID(), "mm_address", true);
$mm_city = get_post_meta(get_the_ID(), "mm_city", true);
$mm_zip = get_post_meta(get_the_ID(), "mm_zip", true);
$mm_country = get_post_meta(get_the_ID(), "mm_country", true);

$mm_url = get_post_meta(get_the_ID(), "mm_url", true);
$mm_featured = get_post_meta(get_the_ID(), "mm_featured", true);

$mm_description = get_post_meta(get_the_ID(), "mm_description", true);

$mm_icon = get_post_meta(get_the_ID(), "mm_icon", true);

$mm_featured_animation = get_post_meta(get_the_ID(), "mm_featured_animation", true);

$mm_info_window = get_post_meta(get_the_ID(), 'mm_info_window', true);

$mm_show_address = get_post_meta(get_the_ID(), 'mm_show_address', true);
$mm_show_zip = get_post_meta(get_the_ID(), 'mm_show_zip', true);
$mm_show_city = get_post_meta(get_the_ID(), 'mm_show_city', true);
$mm_show_country = get_post_meta(get_the_ID(), 'mm_show_country', true);
$mm_show_description = get_post_meta(get_the_ID(), 'mm_show_description', true);
$mm_show_url = get_post_meta(get_the_ID(), 'mm_show_url', true);

$mm_info_window_data = "";
$mm_info_window_data .= '' . $mm_title . '' . '
';
if($mm_address !== "" && $mm_show_address == "yes"){
$mm_info_window_data .= $mm_address . '
';
}
if($mm_zip !== "" && $mm_show_zip == "yes"){
$mm_info_window_data .= $mm_zip . '
';
}
if($mm_city !== "" && $mm_show_city == "yes"){
$mm_info_window_data .= $mm_city . '
';
}
if($mm_country !== "" && $mm_show_country == "yes"){
$mm_info_window_data .= $mm_country . '
';
}
if($mm_description !== "" && $mm_show_description == "yes"){
$mm_info_window_data .= '

' . $mm_description . '


';
}
if($mm_url !== "" && $mm_show_url == "yes"){
$mm_info_window_data .= 'Website';
}

array_push($locations_a, [
$mm_longitude,
$mm_latitude,
$mm_featured,
$mm_icon,
$mm_featured_animation,
$mm_info_window,
$mm_info_window_data
] );
endwhile;

wp_reset_postdata();

$option_check = get_option('mm_plugin_center_check');

if( $option_check['city'] != $map_settings['city'] ||
$option_check['zip'] != $map_settings['zip'] ||
$option_check['country'] != $map_settings['country'] ||
$option_check['address'] != $map_settings['address'] ) {

$center_at = geocode($map_settings['zip'].', '.$map_settings['city'].', '.$map_settings['country'].', '.$map_settings['address']);

update_option( 'mm_center_longitude', $center_at[0] );
update_option( 'mm_center_latitude', $center_at[1] );

$option_check['zip'] = $map_settings['zip'];
$option_check['city'] = $map_settings['city'];
$option_check['country'] = $map_settings['country'];
$option_check['address'] = $map_settings['address'];

update_option( 'mm_plugin_center_check', $option_check);

} else {

$center_at = array(
get_option('mm_center_longitude'),
get_option('mm_center_latitude')
);

}

?>

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top