This lightweight plugin makes it easy to install the millions of GEONAMES Data on your WordPress site. It allows : Install data from one or more file (place & postal code) ; Choose column to install to avoid excessive enlargement of the base ; Choose type of data to install (city, park, road…) ; Rem
Select type of data you want (city, building, lake, mountain…)
08Click ADD
You can insert as many file as you want.
Use
You must use the WordPress tools to get the database. WPDB is your friend . You can write the code directly in your template or in functions.php of your theme.
Name of the table : ($wpdb->prefix)geonames
Names of the columns :
09idwpgn (bigint)
10geonameid (bigint)
11name (varchar)
12asciiname (varchar)
13alternatenames (text)
14latitude (decimal)
15longitude (decimal)
16feature_class (char)
17feature_code (varchar)
18country_code (varchar)
19cc2 (varchar)
20admin1_code (varchar)
21admin2_code (varchar)
22admin3_code (varchar)
23admin4_code (varchar)
24population (bigint)
25elevation (int)
26dem (smallint)
27timezone (varchar)
28modification_date (date)
Feature Class & Code here .
Example : get GPS position for a specific city in a specific country :
global $wpdb; $s = $wpdb->get_row("SELECT latitude, longitude FROM ".$wpdb->prefix."geonames WHERE name='Paris' and country_code='FR' "); echo $s->latitude . " - " . $s->longitude;
Example : 10 most populous cities in Switzerland :
global $wpdb; $s = $wpdb->get_results("SELECT name, population FROM ".$wpdb->prefix."geonames WHERE country_code='CH' and feature_class='P' ORDER BY population DESC LIMIT 10"); foreach($s as $t) { echo $t->name. " : " . $t->population . "<br />"; }
Example : hotels within 40 km from Marbella (ES) :
global $wpdb; $p = $wpdb->get_row("SELECT latitude, longitude FROM ".$wpdb->prefix."geonames WHERE name='Marbella' and country_code='ES' "); $dlat = 40 / 1.852 / 60; $dlon = 40 / 1.852 / 60 / cos($p->latitude * 0.0174533); $s = $wpdb->get_results("SELECT name, latitude, longitude FROM ".$wpdb->prefix."geonames WHERE country_code='ES' and feature_code='HTL' and latitude<".($p->latitude+$dlat)." and latitude>".($p->latitude-$dlat)." and longitude<".($p->longitude+$dlon)." and longitude>".($p->longitude-$dlon)." LIMIT 100"); foreach($s as $t) { $d = (floor(sqrt(pow(($p->latitude-$t->latitude)*60*1.852,2)+pow(($p->longitude-$t->longitude)*60*1.852*cos($p->latitude * 0.0174533),2)))); if($d<=40) echo $t->name. " : " . $d . " km<br />"; }
Example : Suggest cities during the typing by the user (like Google search)
You must use Ajax action and PHP function with the name “wpgeonamesAjax”
In your theme, in function.php ; add : function wpgeonamesAjax() { global $wpdb; $s = $wpdb->get_results(“SELECT name FROM “.$wpdb->prefix.”geonames WHERE country_code=’FR’ and feature_class=’P’ and name LIKE ‘”.strip_tags($_POST[“city”]).”%’ ORDER BY name LIMIT 10″); foreach($s as $t) { echo ‘
FinderPress Media Auditor helps site administrators scan for broken images, missing Media Library files, unreachable media URLs, and other media issues across WordPress content. Use it to audit images, video, audio, PDFs, featured images, and attachment files without sending scan data to an external
The Accepted Payment Methods plugin is a straightforward, lightweight solution that enhances your website by displaying visually appealing icons of the payment methods you accept. This plugin is ideal for a variety of websites, including e-commerce platforms, service-oriented websites, and informati