Hi, I’m trying to change the js file on the single events page that appears when tribe_get_embedded_map(); is echoed.
<script src=”/app/plugins/the-events-calendar/resources/embedded-map.js”></script>
I would like to change the url to one that is inside of my theme folder.
<script src=”/app/themes/mywebsite/assets/scripts/embedded-map.js”></script>
I found this inside of the Embedded_Maps.php in the src/Tribe folder.
protected function enqueue_map_scripts() {
// Setup Google Maps API
$url = apply_filters( 'tribe_events_google_maps_api', '//maps.googleapis.com/maps/api/js' );
wp_enqueue_script( 'tribe_events_google_maps_api', $url, array(), false, true );
// Setup our own script used to initialize each map
$url = Tribe__Events__Template_Factory::getMinFile( tribe_events_resource_url( 'embedded-map.js' ), true );
wp_enqueue_script( self::MAP_HANDLE, $url, array( 'tribe_events_google_maps_api' ), false, true );
$this->map_script_enqueued = true;
}
I have creaeted this function, but it adds a ‘/wp/’ before my link
add_action( 'wp_enqueue_scripts', 'replace_embedded_maps_js' );
function replace_embedded_maps_js(){
$url = apply_filters( 'tribe_events_google_maps_api', '/app/themes/mysite/assets/scripts/embedded-map.js' );
wp_enqueue_script( 'tribe_events_embedded_map', $url, array('tribe_events_google_maps_api'), [], null, true );
}