• Resolved dorjee

    (@dorjee)


    There are a number of plugins that allow you to insert Google Maps or Google Earth extended from Maps in a WP blog. For example: “Google-Maps-Advanced” (or “inline-Google-Maps”), “XML-Google-Maps”, etc.. These plugins (which are often a mess) are interesting, but probably not offer the flexibility of basic javascript code of Google Earth and Maps. So the question is: how to insert a Google Earth or Maps script in a WP post or page?

    I give you the solution here. Just install the Inline Javascript Plugin. Then in the page or post place the Google Earth (or Maps) code between the two tags [inline] and [/inline]. Then it only remains to put the DIV GE or Maps below. As for the procedure call is normally placed in the <BODY> tag with onLoad … it is enough to make a javascript command as window.onload inserted at the end of the script (just before the counter-tag [/inline]). An example below to better understand:

    [inline]
    <script src="http://www.google.com/jsapi?key= write here your Google  API key "></script>
    <script>
    google.load("earth", "1");
    var ge = null;
    function init() {
    google.earth.createInstance("map3d", initCallback, failureCallback);
    }
    function initCallback(object) {
    ge = object;
    ge.getWindow().setVisibility(true);
    }
    function failureCallback(object) {
    }
    // calling of the init procedure when page is loading
    window.onload = init;
    </script>
    [/inline]
    <div id='map3d' style='height: 500px; width: 500px;'></div>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Google Earth (or Maps) API native in WP’ is closed to new replies.