City Temperatures Plugin Page

WARNING, This plugin uses the Yahoo Weather API – which is free to use for non-commercial applications.  Before you use this plugin you should determine whether you are allowed to use this API.

HedmanSoft City Temperatures – This plugin allows you to create a cool widget on your page that displays your current temperature and weather as compared to several other locations in the world.  I needed this for our Homeowner’s Association page where many who live in this community are originally from northern parts of the country, so it’s fun to show what the temperature is in – say Wisconsin – when it is in the 70s here in Florida.

temps

Installation Details

  1. Upload the plugin files to the `/wp-content/plugins/hs_citytemps` directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the ‘Plugins’ screen in WordPress
  3. Use the Settings->HedmanSoft City Temps screen to access the Administration Screen of the plugin

Administration Panel

From the Administration page, you can begin setting up the city temperatures.

ct1

The Administration Panel starts you off with empty values for the “Home Location”, (which is the location where you want to always show temperature and weather conditions) and no additional cities in the table below.  The Administration Panel defaults to using Fahrenheit temperature display and expects you to enter your “home city”.  Enter the Home City name and the Yahoo City ID (which can be obtained here) and press Update Options to save these values.  If you do not supply needed information, you will be informed when you try to save your changes and the offending data will be highlighted like this:

ct2

Once you enter the home city and Yahoo City ID and press Update Options, you can start entering more cities and codes to your list and provide the number of cities you wish to be displayed when the widget is rendered.  The number of cities must be less than or equal to the number of entries in your list or will be automatically adjusted when you save the form.  If you leave the “Number of Cities to Display in Widget” as zero (or do not enter any cities in the table of cities) then the widget will simply display the local temperature and weather condition as shown below.  Using the short code [hs-temp] anywhere on a page or post, you can see the results of the display.

ct13

ct4

The above shows a complete list of random cities in the US and their corresponding Yahoo City Codes.  Now I am ready to render the widget.

ct5

Using the short code [hs_temps] I can place the widget onto my side in the right widget area as a text widget:

ct6

To save on calls to Yahoo Weather, the list of random cities and temperatures are cached for 10 minutes before a new set of cities are randomly chosen.

Short Code Parameters

You can override the default rendering of the city temperatures with the following parameters:

  • hide_home_city=”true” – Setting this to true will not show the upper portion of the widget but simply list the other city data.

ct12