WordPress.org

Ready to get started?Download WordPress

Forums

Google Maps in WP (13 posts)

  1. emmawood
    Member
    Posted 7 years ago #

    I am a beginner with all this stuff - but want a map in my blog - I have got an API key from google, and loaded up a GEO php into my plugins and activated it.
    I tried to load up the beginner map with the code supplied from Google into:
    Write Page, Page content (also the HTML box)
    to get me started.. but although there seems to be white space, nothing shows up.?
    I'm sure I'm doing something very basic wrong.
    Can someone give me a 'simple' step by step as to where you load the code.. etc.
    I'm using Pool 1.0.7 as my theme..
    Please help. Thanks
    Em

  2. MichaelH
    Member
    Posted 7 years ago #

    If the code is PHP code, I believe you'd need a plugin such as:
    ======================
    RunPHP Plugin
    http://www.nosq.com/2004/10/runphp-wordpress-plugin/
    Don't forget to check the "run PHP code?" box on the Write Post and Write Page area.

    CG-QuickPHP
    http://www.chait.net/index.php?p=310
    QuickPHP is really targeted for single function calls or include statements (it does one 'method', with a parenthesized parameter list), constant arguments. But including a php script is then really easy, or calling a function (like any basic WP func..).

    The author, David Chait, uses it for embedding things like CG-FeedRead feeds, or wacky CG-Amazon stuff (since CG-Inline already has an amazon tag).

    PHPExec Plugin
    http://priyadi.net/archives/2005/03/02/wordpress-php-exec-plugin/
    ======================

    Additional info:
    http://codex.wordpress.org/Plugins/Geo
    http://dev.wp-plugins.org/wiki/GeoMashup

  3. emmawood
    Member
    Posted 7 years ago #

    Micheal,
    Thanks for your help.
    I have done what you suggest and downloaded the RunPHP Plugin. Followed all the directions.. but still not a map in sight when I come to writing the page!

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    The code Google gives is Javascript code, I believe. In which case you'll need something to allow you to put scripts into posts without WP hosing them up like it normally does.

    I wrote a plugin to let me do just that a while back:
    http://ottodestruct.com/wpstuff/scriptenabler.zip

    Basically it just prevents WordPress's formatting functions from messing with script code in posts.

  5. emmawood
    Member
    Posted 7 years ago #

    Thanks Otto.
    Done that - and again nothing. Do I need to de-activate the php stuff previously activated?

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    No.

    But it might be helpful if you tell us what code you're putting where and how. The shotgun approach obviously isn't working.

  7. emmawood
    Member
    Posted 7 years ago #

    For sure.
    When Google maps thank you for signing up for a google maps AIP key, they give you an example web page to get you started on your way to 'mapping glory'. (Pasted below)
    It includes my key, that they say is good for all URLs in my directory: http://www.emmawoodphotos.co.uk/blog/
    I assumed that once that was up - I could then edit as I worked through the instructions. Obviously not that easy!
    Does that help explain Otto?
    I really appreciate the help if you have any other suggestions. Thanks

    <!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=ABQIAAAAn5ldIr0maFFOV3lYj4rlgRRfmMzZG2Yqac32kyf0U0MY-EakhRTpd5izgH_PtdA2xIp_NWSjsWCY_w"
    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>

  8. altyfc
    Member
    Posted 7 years ago #

    We have actually been working on something that allows Google Maps to be added to your site with some HTML code. Although it's almost complete, I'm hesitant to give the URL just yet because it has a few final tweaks being done to it. If you'd like details, email me on dedicate at dedicate dot co dot uk and I'll get back to you in about a week's time with the info.

    Paul

  9. emmawood
    Member
    Posted 7 years ago #

    Oh ok.. It's not just me that's having trouble adding Google maps to my site then, if you are writing code!?
    Will email you Paul, thanks. Em

  10. MichaelH
    Member
    Posted 7 years ago #

  11. hackspot
    Member
    Posted 7 years ago #

    Here I'll teach the simplest way to embed google maps on your postings:
    http://hackspot.gotdns.com/blog/archives/42/embedding-google-map-in-wordpress-posts/

    You can see the example here:
    http://hackspot.gotdns.com/blog/archives/18/inline-google-map-for-wordpress/

    Features:
    * easy, easy, easy to use
    * support for setting overlay maps, map types, etc..
    * unlimited number of maps on single page
    * one marker per map
    * support for English and Japanese map captions (on map buttons)
    * uses Google Maps API v.2

    You can find the author of the plugin here:
    http://www.macdiggs.com/index.php/2006/09/08/inline-google-maps-for-wordpress/

  12. syncbox
    Member
    Posted 7 years ago #

    remember that wordpress creates directories on the fly for posts... so your post may not live in the domain.com/blog directory you have a key for.

    I've implemented a google map by placing it in a fixed file and including that into the template files, as in the sidebar, index, whatever...

    additionally, do you have custom permalinks set up? that also may be changing the actual directory structure for where the map displays. The key is only good for a page IN blog/

    not in blog/2006/august/my-post-with-map

  13. vkaryl
    Member
    Posted 7 years ago #

    If you use Windows Live Writer, you WON'T have trouble with maps in posts.

    [Aside from the fact that they don't come close to validating, of course....]

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags