public static function frontend_scripts() { wp_enqueue_script('locations-search-google-maps-api', '//maps.googleapis.com/maps/api/js?key=' . LocationsSearchSettings::get('google_api_key')); wp_enqueue_script('locations-search-clusterer', LocationsSearch::get_url() . '/vendor/marker-clusterer/markerclusterer.js', array(), LOCATIONSSEARCHVERSION); wp_enqueue_script('locations-search', LocationsSearch::get_url() . '/js/locations-search.js', array('locations-search-google-maps-api', 'locations-search-clusterer', 'jquery'), LOCATIONSSEARCHVERSION); wp_localize_script('locations-search', 'locations_search', array('ajax_url' => admin_url('admin-ajax.php'), 'ajax_action' => 'lsajax_search_results', 'map_styles' => apply_filters('locations_search_map_styles', LocationsSearchSettings::get('map_styles')), 'focus_country' => LocationsSearchSettings::get('focus_country'), 'focus_country_strict' => LocationsSearchSettings::get('focus_country_strict'), 'text_did_you_mean' => 'Did you mean:', 'text_0_results' => 'No results found', 'text_1_result' => '1 result found', 'text_more_results' => '# results found', 'text_please_enter_address' => 'Please enter an address', 'error_invalid_request' => 'Invalid request, please verify that the requested address is correct', 'error_query_limit' => 'You have exceeded the maximum number of allowed queries, please wait for some time before trying again', 'error_no_results' => 'No results found, please try a different address', 'error_unknown' => 'There was an unknown error', 'initial_lat' => -33.865, 'initial_lng' => 151.2094, 'text_current_location' => '(current location)', 'map_marker_active' => apply_filters('locations_search_map_marker_active', LocationsSearchModel::get_marker_data(LocationsSearchSettings::get('map_marker_active'))), 'map_cluster' => apply_filters('locations_search_map_cluster', array('imagePath' => LocationsSearch::get_url() . '/vendor/marker-clusterer/m', 'maxZoom' => 13, 'styles' => LocationsSearchModel::get_cluster_data())))); wp_enqueue_style('locations-search', LocationsSearch::get_url() . '/css/locations-search.css', array(), LOCATIONSSEARCHVERSION); }
public function load_assets($hook) { if ($hook == 'location_page_' . self::$page_id) { wp_enqueue_media(); wp_enqueue_script('locations-search-settings', LocationsSearch::get_url() . '/js/settings.js', array('jquery'), LOCATIONSSEARCHVERSION); wp_enqueue_style('locations-search-settings', LocationsSearch::get_url() . '/css/settings.css', array(), LOCATIONSSEARCHVERSION); } }
public function load_assets($hook) { // Only on post edit screen if (!in_array($hook, array('post.php', 'post-new.php')) || get_post_type() != $this->post_type) { return; } // Load assets wp_enqueue_script('location-edit-google-maps-api', '//maps.googleapis.com/maps/api/js?key=' . LocationsSearchSettings::get('google_api_key')); wp_enqueue_script('location-edit-screen', LocationsSearch::get_url() . '/js/location-edit.js', array('location-edit-google-maps-api', 'jquery'), LOCATIONSSEARCHVERSION); wp_enqueue_style('location-edit-screen', LocationsSearch::get_url() . '/css/location-edit.css', array(), LOCATIONSSEARCHVERSION); }