WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Where i put my Google maps Code in wordpress? (4 posts)

  1. Guta
    Member
    Posted 6 years ago #

    Hello.
    I have make one key account in google maps. I DONT want to use PLUGINS to interact googlemaps with wordpress because i must do some advenced topics in the future.
    In Google says that i must pust this code, but it is html with javascript and wordpress is all php files:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps JavaScript API Example</title>
    <script src="http://maps.google.com/maps?file=api&v=2&key=MI_KEY"
    type="text/javascript"></script>
    <script type="text/javascript">

    //<![CDATA[

    function load() {
    if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
    map.setCenter(new GLatLng(37.4419, -122.1419), 13);
    }
    }

    //]]>
    </script>
    </head>
    <body onload="load()" onunload="GUnload()">
    <div id="map" style="width: 500px; height: 300px"></div>
    </body>
    </html>

    I have create one new page (no post) where i want to put the google map, so where or how i put this code so it appears only in that page?

    Thank you for your help.

    PD: I repeat i dont want plugin soluttions

  2. Guta
    Member
    Posted 6 years ago #

    Sorry, after reading my post i understand that the question is so simple as:

    How i insert HTML code (with some javascript) in one page in wordpress?

    Thank you again

  3. Guta
    Member
    Posted 6 years ago #

    I have it!

    I just copy another template and modified it like says here:
    http://codex.wordpress.org/Pages#Page_Templates

    Something like this:

    <?php
    /*
    Template Name: Localizator
    */
    ?>
    <?php get_header();?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title>Google Maps JavaScript API Example</title>

    etc, etc

    I mark it as solved
    Best regards

  4. morsingbo.dk
    Member
    Posted 5 years ago #

    Hello I see you found a solution, but I would be glad if you could explain it to me..

    my google map code:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Den Gamle By på Googlemap</title>
    <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA1dE_Rg0nU4S0U0EuD_3UZRRbdUiHl3oGXAUQW8svr8WwVwV7oBRErO1GFT7JDlUF49GgcAli-PN8aw"
    type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[
    function load() {
    if (GBrowserIsCompatible()) {
    function createMarker(point,html) {
    var marker = new GMarker(point);
    GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml(html);
    });
    return marker;
    }
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
    map.addControl( new GMapTypeControl() );
    map.addControl(new GOverviewMapControl(new GSize(190,150)));
    map.setCenter(new GLatLng(56.158791, 10.192147), 17);
    }

    var point = new GLatLng(56.158170, 10.192312);
    var marker = createMarker(point,'<div style="width:420px;color:#FFFFFF;background-color:#000000"><b>Den Moderne By i Den Gamle By</b>
    <i>Produceret af Philip, Emilie og Niels</i>
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="420" height="333" id="soundslider"><param name="movie" value="http://jlab.dk/2009/gamleby/web01/soundslider.swf?size=1&format=xml&embed_width=420&embed_height=333" /><param name="allowScriptAccess" value="always" /><param name="quality" value="high" /><param name="allowFullScreen" value="true" /><param name="menu" value="false" /><param name="bgcolor" value="#FFFFFF" /><embed src="http://jlab.dk/2009/gamleby/web01/soundslider.swf?size=1&format=xml&embed_width=420&embed_height=333" quality="high" bgcolor="#FFFFFF" width="420" height="333" menu="false" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash"></embed></object></div>')
    map.addOverlay(marker);

    var point = new GLatLng(56.158370, 10.192912);
    var marker = createMarker(point,'<div style="width:420px;color:#FFFFFF;background-color:#000000"><b>Den Moderne By i Den Gamle By</b>
    <i>Produceret af Filip, Emilie og Niels</i>
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="420" height="333" id="soundslider"><param name="movie" value="http://jlab.dk/2009/gamleby/web02/soundslider.swf?size=1&format=xml&embed_width=420&embed_height=333" /><param name="allowScriptAccess" value="always" /><param name="quality" value="high" /><param name="allowFullScreen" value="true" /><param name="menu" value="false" /><param name="bgcolor" value="#000000" /><embed src="http://jlab.dk/2009/gamleby/web02/soundslider.swf?size=1&format=xml&embed_width=420&embed_height=333" quality="high" bgcolor="#000000" width="420" height="333" menu="false" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash"></embed></object></div>')
    map.addOverlay(marker);

    }

    //]]>
    </SCRIPT>

    <META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
    <BODY onload=load() onunload=GUnload()>
    <DIV id=map style="WIDTH: 700px; HEIGHT: 600px"></DIV></BODY></HTML>

Topic Closed

This topic has been closed to new replies.

About this Topic