New Landing How can we help? Themeforest Theme Support Joyn The Include of Google Maps API

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Posted in: Joyn
  • #204926
    nosuchagency
    Member
    Post count: 226

    Hi

    I need to include the Google Maps API including the Places Lib (http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places), but the theme already include the Google Maps API, but without the Places Lib.

    What is the best way to solve this?

    Thanks

    #204986
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    You can insert this code at functions.php of child theme.

    add_action( 'wp_enqueue_scripts', 'sf_map_fix',100 );
    function sf_map_fix()
    { 
      wp_deregister_script('sf-maps');
       wp_dequeue_script( 'sf-maps' );   
       wp_register_script('sf-maps-new', '//maps.google.com/maps/api/js?sensor=false&libraries=places', 'jquery', NULL, TRUE);
       wp_enqueue_script( 'sf-maps' );   
    }
    

    Thanks
    Mohammad

    #205261
    nosuchagency
    Member
    Post count: 226

    Thanks

    I changed it to:

    add_action( ‘wp_enqueue_scripts’, ‘sf_map_fix’, 100 );
    function sf_map_fix () {
    wp_deregister_script( ‘sf-maps’ );
    wp_dequeue_script( ‘sf-maps’ );
    wp_register_script( ‘sf-maps-new’, ‘//maps.google.com/maps/api/js?sensor=false&libraries=places’, ‘jquery’, null, true );
    wp_enqueue_script( ‘sf-maps-new’ );
    }

    #205761
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Great. Thanks for sharing your solution.

    -Rui

    #218476
    nosuchagency
    Member
    Post count: 226

    Resolved! 🙂

    #218498
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Ok.
    -Rui

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.