From f818689684d540d1707472a52b901d653ff332f1 Mon Sep 17 00:00:00 2001 From: Luca Date: Fri, 5 Jan 2018 02:18:37 +0100 Subject: [PATCH] mapa2 - moved from soundwalk --- mapa2.php | 290 +++++++++++++++++++++++++++++++++++++++++++++++++++ soundmap.php | 17 ++- 2 files changed, 306 insertions(+), 1 deletion(-) create mode 100755 mapa2.php diff --git a/mapa2.php b/mapa2.php new file mode 100755 index 0000000..a2ef67a --- /dev/null +++ b/mapa2.php @@ -0,0 +1,290 @@ + 'marker', +); +$posts = get_posts($args); + +// fit to location +$fit = false; +if (isset($_GET['fit'])) { + $fit = true; +} + +?> + + + + + + + + +Mapa de Comunitats + + + + + + + + + + + + + + + + + + + + + + +
LOADING...
+
+
+ +
+ + + + diff --git a/soundmap.php b/soundmap.php index 67ca5d9..a01a33a 100755 --- a/soundmap.php +++ b/soundmap.php @@ -58,6 +58,7 @@ if (!class_exists('Soundmap')){ 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, + 'show_in_rest' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'marker', 'with_front' => false ), 'capability_type' => 'post', @@ -581,8 +582,22 @@ if (!class_exists('Soundmap')){ die(); } + + function soundmap_prepare_marker ($data,$p,$r) { + $_data = $data->data; + $_data['content'] = apply_filters('the_content',get_the_content($p->ID)); + $fields = get_fields(); + foreach ($fields as $name=>$value) : + $f = get_field_object($name); + $_data[str_replace('_','-',$name)] = array($value,$f['label']); + endforeach; + $data->data = $_data; + return $data; + } + function register_filters(){ //add_filter( 'pre_get_posts', array($this, 'pre_get_posts')); + add_filter('rest_prepare_marker',array($this,'soundmap_prepare_marker'),12,3); } function set_query($query){ @@ -595,7 +610,7 @@ if (!class_exists('Soundmap')){ $this->config['query'] = $query; } } - + function getID3($file){ $getID3 = new getID3; $result = array();