[wp-docs] GeoUrls

Cena cena at cox-internet.com
Tue Dec 16 15:41:37 CST 2003


Okay, I've got a preliminary howto on the GeoUrls. I'm sure it's in dire 
need of corrections, so please, feel free. :)

Side note on the FAQ (Matt): I spend some time today updating my index, 
and I'll get back to you on the common questions thing as soon as I can.
Cena

GeoUrls for the Clueless (including the Author) ver. 16 Dec 03

Although the geo-index.php page will become deprecated in future 
releases of WordPress, you can still use the geourl functions in your 
page. First, some background.

Ø What is a Geourl?

According to http://www.geourl.org, it is:

‘…a location-to-URL reverse directory. This will allow you to find URLs 
by their proximity to a given location. Find your neighbor's blog, 
perhaps, or the web page of the restaurants near you.”

In other words, if you’re a blogger living in East Jerusalem, Timbuktu, 
geourls can help you find bloggers living nearby. (In West Jerusalem, 
perhaps.) Generally, geourls find bloggers (if any) living within a 
500-mile radius of your location.

Ø How do I use Geourls?

The first thing you need to do is go to Options->Geo options. Set 
use_geo_positions to ‘true’. Then set use_default_geourl to ‘true’. 
(This will automatically populate the latitude and longitude fields 
every time you post an entry. If you don’t want the lat/long to show, 
simply erase them when before you click ‘Blog This!’)

Next, find your geographical location by latitude and longitude by 
accessing http://www.geourl.org/resources.html (or by clicking on the 
‘see here’ link). When you’ve got that information, head back to your 
Geo options page and input the appropriate data.

NOTE: If you’re living in the western hemisphere (U.S./Canada/S. 
America/Europe?), you’ll need to append a ‘-‘ (negative sign) to the 
beginning of your longitude. (Example: 92.4522 W should be -92.4322 W. 
If you don’t, your longitude will be rendered as 92.4522 E, which puts 
you in China, roughly. No problem, if you’re actually *in* China.)

Second. You need to add some code to your index.php. No need for 
smelling salts, it’s pretty painless! Here we go:

   1. Find this line: <meta name="generator" content="WordPress .72" />
      <!-- leave this for stats -->
   2. Below it, add this:

<?php if(get_settings('use_geo_positions')) {

doGeoUrlHeader($posts);

} ?>

   3. Find this line (also in the <head>): <?php
      //comments_popup_script(); // off by default ?>
   4. Below it, add this:

<?php if(get_settings('use_geo_positions')) {

print_PopUpScript();

} ?>

   5. Congratulate yourself for your elite hacking skillz.
   6. All done? Now, you need to decide where you want your geourl
      information to show up on the page. For this example, we’ll assume
      you want it to come after the date and time of a post, and that
      you’re using the default template.
   7. Find the line: <div class="meta">Filed under: <?php the_category()
      ?> &#8212; <?php the_author() ?> @ <?php the_time() ?></div>
   8. Below that, add:

<?php if(get_settings('use_geo_positions')) { if((get_Lon() != null) && 
(get_Lon() < 360) &&(get_Lon() > -360)) { ?>

&#8212; Posted from: <?php print_Lat(); ?> &#215; <?php print_Lon(); ?>

<?php } } ?>

<?php if(get_settings('use_geo_positions')) { if((get_Lon() != null) && 
(get_Lon() < 360) &&(get_Lon() > -360)) { ?>

<?php print_UrlPopNav(); ?>

<?php } } ?>

9. That’s it! Save and upload.




More information about the docs mailing list