<?php if (!function_exists('add_filter')) { exit; } global $hocwp_tos_tabs; $parent_slug = 'hocwp_theme_option'; $lat_lng = hocwp_get_default_lat_long(); $option = new HOCWP_Option(__('Geo', 'hocwp-theme'), 'hocwp_geo'); $option->set_parent_slug($parent_slug); $option->add_field(array('id' => 'default_lat', 'title' => __('Default Latitude', 'hocwp-theme'), 'default' => $lat_lng['lat'])); $option->add_field(array('id' => 'default_lng', 'title' => __('Default Longitude', 'hocwp-theme'), 'default' => $lat_lng['lng'])); $option->add_option_tab($hocwp_tos_tabs); $option->set_page_header_callback('hocwp_theme_option_form_before'); $option->set_page_footer_callback('hocwp_theme_option_form_after'); $option->set_page_sidebar_callback('hocwp_theme_option_sidebar_tab'); $option->init(); hocwp_option_add_object_to_list($option);
function hocwp_field_google_maps($args = array()) { hocwp_field_sanitize_args($args); $lat_lng = hocwp_get_default_lat_long(); $id = hocwp_get_value_by_key($args, 'id', 'maps_content'); if (empty($id)) { $id = 'maps_content'; } $address = hocwp_get_value_by_key($args, 'address'); $long = hocwp_get_value_by_key($args, 'long'); $lat = hocwp_get_value_by_key($args, 'lat'); $lang = hocwp_get_language(); $zoom = hocwp_get_value_by_key($args, 'zoom', 15); $google_maps = hocwp_get_value_by_key($args, 'google_maps'); if (empty($long) || empty($lat)) { $lat = $lat_lng['lat']; $long = $lat_lng['lng']; $zoom = 5; } if (empty($google_maps)) { $google_maps = json_encode(array('lat' => $lat, 'lng' => $long)); } $draggable = hocwp_get_value_by_key($args, 'draggable', false); $marker_title = hocwp_get_value_by_key($args, 'marker_title'); $post_id = hocwp_get_value_by_key($args, 'post_id'); $scrollwheel = hocwp_get_value_by_key($args, 'scrollwheel', false); if (empty($marker_title)) { $marker_title = __('Drag to find address!', 'hocwp-theme'); } hocwp_field_before($args); ?> <div id="<?php echo $id; ?> " class="hocwp-field-maps" data-scrollwheel="<?php echo hocwp_bool_to_int($scrollwheel); ?> " data-post-id="<?php echo $post_id; ?> " data-zoom="<?php echo $zoom; ?> " data-marker-title="<?php echo $marker_title; ?> " data-draggable="<?php echo hocwp_bool_to_int($draggable); ?> " data-address="<?php echo $address; ?> " data-long="<?php echo $long; ?> " data-lat="<?php echo $lat; ?> " style="width: 100%; height: 350px; position: relative; background-color: rgb(229, 227, 223); overflow: hidden;"></div> <?php hocwp_field_input_hidden(array('id' => 'google_maps', 'label' => '', 'field_callback' => 'hocwp_field_input_hidden', 'value' => $google_maps)); hocwp_field_after($args); }