Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8848419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:25:09+00:00 2026-06-14T12:25:09+00:00

I am implementing Google Maps in one of my pages. I know I need

  • 0

I am implementing Google Maps in one of my pages. I know I need to add onload="initialize()" onunload="GUnload()" within the <body> tag but I am not sure how.

Currently within my page I have pasted the following:

<body onload="initialize()" onunload="GUnload()">
  <p>To Add your Google Map you must first plot your address by searching</p>
  <p>
    <input id="address" type="textbox" value="" placeholder="Search For Your Address">
    <input type="button" value="Plot Your Address" onclick="codeAddress()">
  </p>
  <div id="map_canvas" style="width: 770px; height: 270px; border: 5px solid #EDEDED">
  </div>
</body>

Even though this actually works, it must be terrible mark-up as it is a body section within a body section for the main page.

I am using WordPress but I’m not sure if the above markup is OK or whether I should be putting it in the main page body tag. The problem is that I am not sure how to do this if needed. As I only need it on one page and not my entire site, I don’t want to add this to the site’s body tag to initialize Google Maps on every page and slow the site down.

Thanks for any advice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T12:25:10+00:00Added an answer on June 14, 2026 at 12:25 pm

    No you don’t want to be adding another body tag into the specific page template that uses the map. Your opening <body> tag will be in header.php , you should get the page ID of the specific page which you want to load it on and do;

    <body <?php if (is_page(374)) { echo 'onload="initialize()" onunload="GUnload()"'; } ?>>
    

    in header.php

    Which will add that code to (in my instance) page 374.

    To find the page id, just hover over it in the Pages section in the backend and you can see the ID in the link url.

    For multiple pages you would use;

    <body <?php if (is_page(array(374,375))) { echo 'onload="initialize()" onunload="GUnload()"'; } ?>>
    

    and you can also use the slug or title instead of ID, but of course they are easy for your client to change and stop that code working. Here’s the codex link on is_page;

    http://codex.wordpress.org/Function_Reference/is_page

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm implementing Google Maps into a new project and one page should return a
While implementing google plus one button through addthis on one our localized pages where
I am implementing Google Analytics on my mobile web application, and I need to
I'm implementing a Google Map on a website. One requirement is to display a
I'm implementing Bing Maps on a page (I'd prefer Google Maps, but it's not
I am implementing Google maps V3, I have a feature to search a location
Two questions: NOTE: I am not implementing google maps in my application, I am
Ive been trying to solve some issues for implementing google maps with the api
I'm implementing Google Maps service with PHP/CURL and currently have a problem with Maps
I'm currently working on a Google Maps project and am implementing a search function.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.