I set the icon image on my google map using the absolute url as follows:
icon: 'http://mysite/wp-content/plugins/my_plugin/images/icon1.png'
I set the image in this script: http://mysite/wp-content/plugins/my_plugin/js/myscript.js
Can I use a relative URL? Will the path from js script be: ../ images / icon1.png I tried everything I could come up with. Google map is in the WordPress plugin.
WordPress has many PHP functions for defining file paths. I could save the file path in PHP and then send it to a javascript script, but I hope there will be a better, easier way. I donβt want to hardcode the path to the image file, as this will be another thing that could go wrong. Perhaps there are javascript functions that will work in this case.
Thanks.
source share