-
Upload the whereabouts folder to your /wp-content/plugins directory.
-
Activate the “Whereabouts” plugin in the WordPress administration interface.
-
Go to “Settings” -> “Whereabouts” and activate “Use Google to get location data”, enter you API key and set the “API Request Language”.
-
On the dashboard, set your location.
-
Go to “Appearance” -> “Widgets” and add a Wherebouts widget to a sidebar of your choosing. (You have the options to chose the user, whose location you want to display, link the location to Google Maps and display the time zone name.)
Please note: The widget will only be displayed if the specified user has set his/her location.
Styling
There is no extra styling for the widget. You can however do it yourself, in your theme. This is what the HTML looks like:
<dl class="whab-info">
<dt class="whab-label whab-label-location">Current Location:</dt>
<dd class="whab-location">...</dd>
<dt class="whab-label whab-label-time">Local Time:</dt>
<dd class="whab-time">12:34 <span class="whab-timezone-name">...</span></dd>
</dl>
Shortcode
You can also generate this HTML code anywhere in your theme by using this shortcode:
[whereabouts user="2" link_location="1" time_format="H:i" show_tz="1"]
You need to enter a valid user id and the specified user must have saved his/her location for the widget to be displayed.
Filter
There is a filter available to change the html output of the widget/shortcode:
whab_widget_output
Three argument variables are availabe:
$output The html Whereabouts generates by default as a string
$args The widget settings as an array
$location The location values as an array
You could use it in your theme’s functions.php like this:
add_filter( 'whab_widget_output', 'my_function_to_change_location_widget', 10, 3 );
function my_function_to_change_location_widget( $output, $args, $location ) {
$output = '<p class="my-location">' . $location['location_name'] . ', ';
$output .= date( $args['time_format'], time() + $location['utc_difference'] );
if ( $args['show_tz'] ) {
$output .= ' (' . $location['timezone_name'] . ')';
}
return $output . '</p>';
}
This will change the html output to:
<p class="my-location">Paris, France, 12:34 (Central European Standard Time)</p>