Pronamic Google Maps
[resolved] Modify plugin properly site.js (4 posts)

  1. jcuenin
    Posted 3 years ago #

    Hi everyone,

    i would like to find a way to modify the plugin and most precisely the site.js file.

    I could change directly the site.js file but then at every update i will have to modify the code again.

    So is there a way for me to unregister the base site.js and load m custom one instead and that the plugin can be updated without troubles?

    I saw i can use hooks and such but i am not so much confident with that.

    Thanks in advance,



  2. Remco Tolsma
    Plugin Author

    Posted 3 years ago #

    I think this is possible, we register the script in the following file:

    Maybe you can deregister this script and register your own script.

  3. jcuenin
    Posted 3 years ago #

    Thank you for your answer, yes i did try this, my script was loading but i got that error in the console : Uncaught ReferenceError: google is not defined.

    I just copied the old script and did my modifications.

    When i did my modifications inside site.js it was working though.

  4. jcuenin
    Posted 3 years ago #

    Alright it's working my bad!

    I forgot to add array('jquery', 'google-jsapi') when i was registering my plugin.

    So basicly what i did was :

    Create a new plugin named my google maps and a modified site.js to deregister the base script and then register mine.

    add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );

    function my_deregister_javascript() {
    wp_deregister_script( 'pronamic-google-maps-site' );
    'pronamic-google-maps-site' ,
    plugins_url('my-google-maps/site.js') ,
    array('jquery', 'google-jsapi')

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Pronamic Google Maps
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic