public function getScripts() { $exploded_string = explode('@', get_field('google_map', 'option')); $further_exploded_string = explode(',', $exploded_string[1]); $latitude = $further_exploded_string[0]; $longitude = $further_exploded_string[1]; $this->scripts[] = ['file' => 'map.js', 'localize' => ['name' => 'map', 'data' => ['lon' => $longitude, 'lat' => $latitude, 'icon' => THEME_DIR . '/img/pin.png']]]; return parent::getScripts(); }
public function getScripts() { if (is_user_logged_in()) { $this->scripts = array_merge($this->scripts, ['parties/mustache.min.js', 'parties/gsap.min.js', 'parties/jquery.selectric.min.js', 'parties/jquery.qtip.min.js', ['file' => 'app.min.js', 'localize' => ['name' => 'myAjax', 'data' => ['ajax_url' => admin_url('admin-ajax.php'), 'current_user_id' => get_current_user_id(), 'themeDir' => THEME_DIR]]]]); } else { $this->scripts = array_merge($this->scripts, [['file' => 'login.min.js', 'localize' => ['name' => 'myAjax', 'data' => ['ajax_url' => admin_url('admin-ajax.php'), 'current_user_id' => get_current_user_id(), 'themeDir' => THEME_DIR]]]]); } return parent::getScripts(); }
public function getScripts() { if ($postcode = get_user_meta(get_current_user_id(), 'billing_postcode', true)) { $long_lang = json_decode(file_get_contents('https://maps.googleapis.com/maps/api/geocode/json?key=AIzaSyDRgQenEbBj0BF-QBdCfVDOPnWGClYX5W8&v=3&address=' . urlencode($postcode))); if ($long_lang && count($long_lang->results) > 0) { $longitude = $long_lang->results[0]->geometry->location->lng; $latitude = $long_lang->results[0]->geometry->location->lat; } } else { $exploded_string = explode('@', get_field('google_map', 'option')); $further_exploded_string = explode(',', $exploded_string[1]); $latitude = $further_exploded_string[0]; $longitude = $further_exploded_string[1]; } $this->scripts[] = ['file' => 'map.js', 'localize' => ['name' => 'map', 'data' => ['lon' => $longitude, 'lat' => $latitude, 'icon' => THEME_DIR . '/img/pin.png']]]; return parent::getScripts(); }
public function getScripts() { wp_enqueue_script('jquery'); $this->scripts[] = ['file' => 'app.min.js', 'localize' => ['name' => 'myAjax', 'data' => ['ajaxurl' => admin_url('admin-ajax.php')]]]; return parent::getScripts(); }
/** * get_scripts static method. * * @return Array */ public function getScripts() { return parent::getScripts(); }
public function getScripts() { $this->scripts['map']['localize'] = ['name' => 'locations', 'data' => get_congregations()]; return parent::getScripts(); }