• Hi guys,

    I need to implement Google maps into this website without using a plugin, though I have a custom written jscript function in my scripts.js.

    Now i’m left puzzled on how to make this visual on wordpress. What I tried so far is this, and i’m not sure how to otherwise.

    //Google Maps
    function gmaps_header(){
    ?>
    	<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
    <?php
    }
    add_action('wp_head','gmaps_header');
    
    function gmap() {
    if ( is_page('contact') ) {
    	    wp_register_script('initialize', ("". get_template_directory_uri() ."/scripts/script.js"));
    	wp_enqueue_script('initialize'); }
    }
    add_action( 'wp_print_scripts', 'gmap');
Viewing 16 replies (of 16 total)
  • @dvd709: what do you mean exactly with

    All I have to do now is combine it with my JS code because it’s not allocated to me but just somewhere random, any idea how I can do this?

Viewing 16 replies (of 16 total)
  • The topic ‘Google maps function without a plugin’ is closed to new replies.