The Hiztory Plugin – This Day in History on Your WordPress Website

We’ve become accustomed to writing snippets of shortcode – both the good and bad – and publishing here on Internoetics… but we’ve generally refrained from venturing into the WordPress.org plugin realm because of the issues generally associated with the commitment that comes with continued development of anything once you release it as a more formal ‘product’. That safe distance we’ve maintained has come to an end.

We introduced you to some shortcode last week that would render ‘This Day in History’ information on your WordPress website (utilising our little API at Hiztory.org). The code was flawed for one reason above any other: it would only retrieve a single result. It didn’t take more than a few hours before we had people asking for something that would permit them to add multiple events. What we’ll provide on this post will provide that feature.

Although Hiztory was originally built for one of our aviation websites, and despite aviation content being a clear focus moving forward, it hasn’t detracted us form building upon the data and adding multiple other modules that relate to various interest groups or countries. Despite not having released these ‘other’ components into the wild (just yet), we though we’d release version 0.1 of a WordPress plugin that eases the techo-burden of displaying this and all future content on your website.

Plugin Title: Hiztory
Description: Display historical events on your WordPress website with shortcode.
Download (downloaded 587 times) | Plugin Page

Primary Differences

If you’re using the shortcode we’ve previously published, sadly, changing over to the plugin will require you to generate new shortcode in your posts and/or pages; it became apparent quite quickly that the options that we formerly provided weren’t the most appropriate. However, the change is advantageous. The time associated with the API request is now the time associated with your blog; we always expected to provide an option to include a GMT offset… but that isn’t necessary since we now plug into your own WordPress website’s timezone (as defined in SettingsGeneral). We now permit up to 15 results to be rendered on your website and have coded in a few extras that’ll permit you to offer a measure of customisation with how results are displayed.

Installing Hiztory

Like any plugin that you’ve ever installed into WordPress, it can be installed in a number of different ways.

The easiest method of installation is via the ‘Install Plugins’ menu on your own WordPress blog via  Plugins  ->  Add New  in the left hand menu. Search for “hiztory“. Since it’s essentially a misspelled word, we’re the only result with that keyword. Click Install Now… then Activate.

Of course, you could just download the zip file directly and then either upload it via the Upload option on the ‘Install Plugin’ administration page referenced above… or you could simply FTP the contents into your wp-content/plugins directory.

Settings

Once you click on Activate, you’ll see a Settings menu; select it. Alternatively, you will now be able to select the History Shortcode option from your Settings menu.

Hiztory Setting from the WP Settings Menu

Selecting the settings menu directs you to the shortcode generator

The Hiztory shortcode generator is a form that’ll construct shortcode based on the (non-default) options your select.

Hiztory Shortcode Generator

By clicking on  Get Shortcode  at this point we’ll just generate default usage by way of nothing other than the [hiztory] shortcode.

Default Usage

The default output provides us with one historical aviation event. You’ll likely want to change this!

AFirst official test flight of the U.S. Navy Vought XSSM-N-8 Regulus, FTV-1, (Flight Test Vehicle), '1', from Rogers Dry Lake, Edwards AFB, California, goes badly when, after reaching an altitude of several hundred feet after lift-off, the J33 jet-powered missile rolls violently right and crashes. Had it rolled to the left, it would likely have struck the USN Lockheed TV-2 Seastar chaseplane piloted by Chuck Miller with Roy Pearson on board as missile controller. Cause is found to be a broken brass pin in the port elevator pump assembly that allowed the elevator to deploy, the pin having been worn out during months of ground test runs. Brass is subsequently replaced by steel pins, and problem is solved. - 22nd November 1950

Using the shortcode generator, and as an example, we’ll generate three results that’ll be cached locally for two hours. We’ll also change the formatting of the date so it renders as Sun 3rd Dec, 1944… and we’ll apply style to the date with html tags.

[hiztory number="3" datetags="em,strong" dateformat="D jS M, Y" cache="7200"]

Copy and paste the shortcode into your post/page text editor

You should note that the datetags, or the html formatting for the date, doesn’t include the < or > tag; this is automatically applied with the results.

The shortcode will generate the following result:

  • AFirst official test flight of the U.S. Navy Vought XSSM-N-8 Regulus, FTV-1, (Flight Test Vehicle), '1', from Rogers Dry Lake, Edwards AFB, California, goes badly when, after reaching an altitude of several hundred feet after lift-off, the J33 jet-powered missile rolls violently right and crashes. Had it rolled to the left, it would likely have struck the USN Lockheed TV-2 Seastar chaseplane piloted by Chuck Miller with Roy Pearson on board as missile controller. Cause is found to be a broken brass pin in the port elevator pump assembly that allowed the elevator to deploy, the pin having been worn out during months of ground test runs. Brass is subsequently replaced by steel pins, and problem is solved. - Wed 22nd Nov, 1950
  • A United States Air Force Douglas C-124A Globemaster II, 51-0107, c/n 43441, on approach to Elmendorf AFB, Anchorage, Alaska, United States crashes into a remote glacier. The wreckage was found several days later on the South side of Mount Gannett. There were no survivors killing all 52 aboard. 4th worst accident involving a Douglas C-124 This includes crashes as a result of criminal acts (shoot down, sabotage etc.) and does also include ground fatalities. 4th loss of a Douglas C-124. This is the 4th Douglas C-124 plane that was damaged beyond repair as result of an accident, a criminal act or a non-operational occurrence (hangar fire, hurricanes etc.) Debris from the crash was again found in June 2012. - Sat 22nd Nov, 1952
  • Japan Airlines Flight 2 was a flight that was piloted by Captain Kohei Asoh. The DC-8 plane was scheduled to land at San Francisco International Airport but due to heavy fog and other factors, Asoh mistakenly landed the plane in the waters of San Francisco Bay, two and a half miles short of the runway. None of the 96 passengers or 11 crew were killed or injured in the mishap. The plane was recovered 55 hours after the incident. - Fri 22nd Nov, 1968

Of course, you can choose not to display results in a list (as is the default case). In the next example, we’ll retrieve three historical events and format them in a block of text. By default, we’ll add the <br> tags after each event (you can change this in the option titled ‘After post HTML‘).

[hiztory number="3" type="events" datetags="strong" returnaslist="0" dateformat="l jS M, Y" cache="7200"]

Result:

Margaret Thatcher announces her resignation as British Prime Minister - Thursday 22nd Nov, 1990
Sandra Volker swims world record 50m backstroke (28.57 seconds) - Sunday 22nd Nov, 1992
US 63rd manned space mission STS 33 (Discovery 9) launches into orbit - Wednesday 22nd Nov, 1989

 

Retrieving Results for Another Date

By default, we’ll select the date associated with your WordPress installation in making our request to the API. At times, however, it might be necessary to render results for another arbitrary date.

By unticking the option that says “Yes, use WordPress blog time of for data requests?”, a date option appears. Keep in mind that this is a static date reference that won’t change over time.

Other Features

Some other features of the shortcode generation include:

  • Events relating to deaths, births, events and aviation.
  • Results between 1 and 15.
  • Custom separator between the content and date.
  • Defined or custom date format (using PHP’s date() function).

Using Shortcode in a Sidebar?

By default, WordPress doesn’t enable the filter that permits you to use shortcode in a sidebar widget. If you plan on using this plugin, a sidebar widget is probably the most appropriate place to display random history. To enable shortcode in widgets, we’ve create a simple form that’ll activate that function globally; it works outside our plugin as well.

Enable/Disable Sidebar Shortcode Support

RSS Feeds

There are a number of RSS feeds available that generate random output for each day. They are:

Births: http://www.hiztory.org/rss/birth.rss
Deaths: http://www.hiztory.org/rss/death.rss
Events: http://www.hiztory.org/rss/event.rss
Aviation: http://www.hiztory.org/rss/aviation.rss

The feeds can be consumed by most blogs and other CMS platforms by way of widgets and other types of integrated functionality. Certainly, in WordPress, there are countless plugins that’ll render feeds in different ways – not to mention shortcode, including our own.

The feeds are based on Australian Eastern Standard Time. If you’re elsewhere in the world, you can access a local feed using the following format:

http://www.hiztory.org/10/23/aviation.rss

Format is as follows: http://www.hiztory.org/[month]/[date]/[data-type].rss

The Future

We’ll build upon both the API and this plugin based almost exclusively on the feedback we receive. Some of the features that we’ll be including sooner rather than later include the following:

  • Ability to render results beyond the 15 limit currently imposed.
  • The API will shortly permit multiple events from multiple user defined categories (at the moment we only allow one category per request).
  • Geo-specific history queries
  • Additional categories (tech, marine, rail, country specific etc.).
  • Keyword filtering.

As a matter of interest, the shortcode we use to build the WordPress download box (with the download count) is scheduled in late January.

Let us know what you think.

Download from WordPress

Plugin Title: Hiztory
Description: Display historical events on your WordPress website with shortcode.
Download (downloaded 587 times) | Plugin Page
First Name:
Your Email Address:
 


If you liked this article, you may also like:

  1. “This Day in History” Information on Your WordPress Website with Shortcode
  2. WordPress Plugin: Lorem Ipsum Shortcode Generator
  3. Add a Facebook Follow/Subscribe Button to Your WordPress Website with Shortcode
  4. All Dates of a Year Into an Array with PHP
  5. Display a Random Quote on your Website with WordPress Shortcode
About Marty

is a passionate web developer from Sydney, Australia. He owns about 600 websites and makes a healthy living from working the web. As a day job, he works as a pilot for an international airline. Follow Marty on Twitter or Google+.

Trackbacks

  1. […] one of our aviation websites , we use a version of our Hiztory plugin to render a large amount of aviation history relevant to each day of the year (it’s actually […]

Please leave a comment or question!

*