Ip2location plugin in my template header?

I’m assuming you’re using “IP2Location Tag WordPress Plugin”. In main file of IP2Location plugin, the class instance is created and assigned to the variable. $ip2location_tags = new IP2LocationTags(); To use the plugin in theme, just use the global variable $ip2location_tags. Remember to make sure that the class IP2LocationTags exists first and use global keyword. if … Read more

Querying posts by latitude and longitude to build a Google Maps with several markers

To connect your meta fields with the “Geo Data Store”-Plugin, you simply take the name of the meta key/field and map it with the filter to the plugin. add_filter( ‘sc_geodatastore_meta_keys’, ‘wpse82502_lat_lng_metakey_mapping’ ); function wpse82502_lat_lng_metakey_mapping( $keys ) { $keys[] = “your_meta_key_field_name”; return $keys; } To get the data from PHP to JS, simply use wp_localize_script().

Redirect user on first visit based on geographical location

I would say use a $_SESSION[‘var’] var or $_COOKIE[] to check if the link is clicked. Looks like the plugin is calling the geo_redirect_client_location function and then redirecting. function geo_redirect_client_location(){ $geo = new Geo_Redirect(); $geo->checkIfRedirectNeeded(); } I’m not familiar enough with the plugin but I would so something like: <a href=”https://wordpress.stackexchange.com/questions/89111/example-intenational-sitelink.com/?show_intl=true”>Link on US site to … Read more

Pass data from wordpress to javascript in JSON

Try wrapping your array in json_encode(): function add_map_data() { $objName = “MapData”; $array = array( “MapViewLatitude” => “51.505”, “MapViewLongitude” => “-0.09”, ); wp_enqueue_script( ‘mapdata’, get_bloginfo(‘template_url’).’/custom/map.js’, null, null, false ); wp_localize_script( ‘mapdata’, $objName, array(‘my_arr’ =>json_encode($array))); } add_action( ‘wp_enqueue_scripts’, ‘add_map_data’); Next step is to parse the JSON string back to a JSON object in JavaScript so: //first … Read more

Redirection based on location but without affecting search bots

Search Help Google to determine the site language and to serve the right page for the users in different countries. Mark up language attributes correctly. Use <html lang=”en_UK”> and <html lang=”en_US”>. Use <link rel=”alternate” hreflang=”x” /> in page <head>. It’s also important to specify site targeting in Google Webmaster Tools. Referrers I believe people residing … Read more