WordPress.org

Support

Support » Plugins and Hacks » Pronamic Google Maps » [Resolved] Modify plugin properly site.js

[Resolved] Modify plugin properly site.js

  • 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,

    regards

    http://wordpress.org/extend/plugins/pronamic-google-maps/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Remco Tolsma

    @remcotolsma

    I think this is possible, we register the script in the following file:
    https://github.com/pronamic/wp-pronamic-google-maps/blob/2.2.4/classes/Pronamic/Google/Maps/Site.php#L39

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

    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.

    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’ );
    wp_register_script(
    ‘pronamic-google-maps-site’ ,
    plugins_url(‘my-google-maps/site.js’) ,
    array(‘jquery’, ‘google-jsapi’)
    );
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Modify plugin properly site.js’ is closed to new replies.
Skip to toolbar