Support » Fixing WordPress » How to configure google maps in wordpress?

  • Resolved Guta


    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”
    <html xmlns=””>
    <meta http-equiv=”content-type” content=”text/html; charset=utf-8″/>
    <title>Google Maps JavaScript API Example</title>
    <script src=””
    <script type=”text/javascript”>


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

    <body onload=”load()” onunload=”GUnload()”>
    <div id=”map” style=”width: 500px; height: 300px”></div>

    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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Samuel Wood (Otto)

    (@otto42) Admin

    What they gave you is a complete html page. You can make your own Page Template and make that code do, more or less, whatever you want it to do.

    Ok i understand, but it seems that i can’t mix html code with php code as wordpress do.
    For example. I have created one new Page template copying contact.php to maps.php wich looks like this:

    Template Name: Localizator
    $cp_question = "6+3 = ?";
    $cp_answer = "9";
    <?php get_header(); ?>
            <div id="content">
            <div id="content-main">
            <?php if (have_posts()) : ?>
                            <?php while (have_posts()) : the_post(); ?>
                                    <div class="post">
                                            //validate email adress
                                            function is_valid_email($email)
                                                    return (eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$"\
    , $email));

    etc, etc

    But if i put the html code anywhere it does not work. It says error in line x
    So. where must i put my html googlemaps code?
    How can i put this code in contact.php for example?

    Thank you very much and excuses my newbie questions. I am sys admin and Webmasters world is very dificult…

    Ok I have it!
    Thank you,thenk you very much.

    I just copy another template and modified it like:

    Template Name: Localizator
    <?php get_header();?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    <html xmlns="">
        <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

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to configure google maps in wordpress?’ is closed to new replies.