Forum Replies Created
-
AuthorPosts
-
ndbeMemberOk upgrade fixed this so we can close the topic. Next Time I will remember to check for new version first.
ndbeMember@Steve Why not? I took it from the user guide and its doing what it should do.
@mcmaster 0.9.9.2 but I will test 0.9.9.4
ndbeMemberThis is a simple solution to put google maps in your admin panel. User can drag the marker and the position will be saved in latLang custom field:
piklist('field',array( 'type'=>'html', 'label' => 'Map', 'value' => '<div id="project_map" style="height:500px;"></div>', )); piklist('field',array( 'type'=>'hidden', 'field'=>'latLang' )); ?> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> <script> var map; var marker var latLangField = jQuery('#_post_meta_latLang_0'); var zoom = 15; var latLang = latLangField.val(); if(latLang == '') { latLang = "54.470636, 18.469391"; zoom = 8; } latLang = latLang.split(','); function initialize() { var mapOptions = { zoom:zoom, center: new google.maps.LatLng(latLang[0],latLang[1]) } map = new google.maps.Map(document.getElementById('project_map'),mapOptions); marker = new google.maps.Marker({ draggable: true, position: new google.maps.LatLng(latLang[0],latLang[1]), map: map, title: "Your location" }); google.maps.event.addListener(marker, 'dragend', function (event) { var lat = this.getPosition().lat(); var lang = this.getPosition().lng(); latLangField.val(lat+','+lang); }); } google.maps.event.addDomListener(window, 'load', initialize); </script> <?phpYou will have to change ‘#_post_meta_latLang_0’ to the ID of your hidden field.
ndbeMember1. Never mind i got this 🙂
2. I meant WordPress “custom fields” meta box (not the look of my metabox). As You can see I have
'scope' => 'post_meta'
I can access this variable with get_post_meta but I can’t see this in “custom fields” metabox in admin panel. Normal fields (not group fields) after saving appear in “custom fields” metabox. Is that normal behavior or some bug or something? -
AuthorPosts