Using an image map in a WordPress page or post

How do I put an image map in a WordPress.org page, post or widget?

Being able to define bits of an image as ‘buttons’ for links is handy – it gives you greater graphic control over your pages, for a start.

For a blogging newcomer it’s not easy or obvious though and a Google search reveals the usual lack of simple ‘how to’ information.  Forget the WP Codex (unless you’re a complete geek or you enjoy being made to feel stupid because you don’t eat, breathe and sleep Php).

For regular, non-technical folks like you and me, here’s how you do it:

1) Make sure the image you want to use as your ‘image map’ is already hosted somewhere online (i.e. your blog uploads folder or some kind of free image hosting service like PhotoBucket)

2) Go to Chris Seidel’s handy little image-mapping tool and, using the URL of your image, follow the instructions to generate lists of the co-ordinates for the areas in your image that you want to make into ‘buttons’.

For square / rectangular areas (these will be referred to as “rect” in your HTML code) you’ll need 4 co-ordinates (each corner). For complex shapes (these will be referred to as “polygon” in HTML) you’ll need as many co-ordinates as it takes to define the shape.

When you’ve defined the shape, copy and paste the list of co-ordinates for the area into a text file, label them so you know which area they define and save for use in step 4) below.

3) Now copy and paste the following HTML code from this page:

<map id=”counties” name=”counties”>

<area title=”London” shape=”polygon” coords=”357, 523, 361, 534, 369, 530, 382, 528, 388, 524, 386, 517, 398, 517, 398, 510, 386, 501, 382, 494, 372, 499, 357, 503, 356, 522″ href=”http://www.Google.com” alt=”London”></area>

</map>

<p><img usemap=”#counties” src=”http://i768.photobucket.com/albums/xx325/Reviewmylocation/region-map.jpg” border=”0″ alt=”Reviewmylocationmap” width=”550″ height=”651″/></p>

…and paste it into a document so you can edit it.

The above code is what makes the image map at the bottom of this page work.  You can see that I’ve defined a single area – London – to act as a button (in this case, linking to www.google.com).  This button is defined by the red block of code.

To turn it into your image with your selected area, you’re going to need to replace the image URL with your image’s URL, the co-ordinates with your co-ordinates (refer to your lists), the names you want to give your button and the link URL you want the user to go to when the button’s clicked.

When you’ve done that, save it and test it by pasting it into a post on your blog – making sure that you paste it into the HTML window of the post editor, NOT the Visual editor window (as it won’t work).

4) To make more areas of your image into buttons, go back to your HTML and copy/paste that red block as many times as you need buttons between the green tags.

5) Then go through each area of red code and replace the existing co-ords with new ones from your saved area lists.  Then do the same for the area names and the target URLs.

Hope that was useful – leave a comment to let me know how you got on.

London nextcounty

(and so on.....)

Reviewmylocationmap

Promotion: VW camper van designer greetings cards and prints – made in Cornwall, UK

Goose Chase Design - VW CampersFresh, contemporary English greeting cards – designed and printed in Cornwall by Goose Chase Design

If you’re looking for a greeting card that stands out from the rest, you’ve come to the right place.

Inspired by the English sea-side, cream teas and quirky kitchen paraphenalia, UK illustrator Sarah Nelson’s charming and delicate designs make the perfect gift – either as greetings cards or framed prints.

Goose Chase Design - Cat and boat imagesExplore the complete collection at www.goosechasedesign.co.uk – where you can order online for worldwide delivery or find a stockist near you.

Want to send someone special a free Goose Chase Design e-card? Click here.

3 simple rules for web design

PIGHere are 3 basic rules of web design that should save you a great deal of heartache and stress

A website needs to be:

1) Well designed. Even if it’s one page, a site needs to look professional and graphically attractive. If not, it doesn’t matter how effectively it works, people will still judge it to be atiquated or naff.

2) Easily found by Google for your business’s keywords. If each of your page titles is just your name and your company name, then your designer doesn’t understand how Google works. It’s not hard to write page titles with Google in mind.

3) Easy to update. Fresh content is the oxygen that keeps your site alive in Google’s eyes. If you have to run back to your web designer every time you want / need to add something, one of two things is going to happen: you’re either going to get fleeced or you’ll end up in a bitter relationship because everything will have to depend on the designer’s ‘goodwill’.

If you ONLY check out these three things before going ahead with your web project, you’ll save yourself a lot of money and a considerable amount of stress.

[Read more...]