This Day in Aviation History on Your Website

We have a large number of aviation APIs that will be made available in the next few months that’ll permit you to include different types of aviation data from our array of applications into your own website or WordPress blog. One of the first sites we built specifically for Flight and our readers is Hiztory.org .

Hiztory.org is an automated data repository that builds upon historical events, deaths, births and, of course, historical aviation events. Despite the fact that we’re adding other industry specific areas, it’s the aviation area that motivated the service and the feature that’ll be discussed in this post.

The History of the Hiztory Plugin

We originally wrote this post with a big block of code that one had to copy into a WordPress theme’s functions.php file before using very specific shortcode in the WP text editor (with reference to the large number of configuration variables) before any data would be rendered on your WordPress website. Despite writing lots of code in this manner in the past on some of our techy websites, we knew that our simple pilot friends would struggle with the techno-babble of it all.

We then wrote the shortcode into a simple plugin before realising that since we’re providing access to aviation history, why not open up the plugin to historical events, births and deaths as well (other elements of our Hiztory.org API). Of course, this presented additional challenges. For example, depending on whether you’re retrieving one historical birth record or ten, you’ll have to either query birth or births — a subtle difference… but a difference that’ll mean retrieving actual results or generating a page full of errors. As such, we built a shortcode generator into the WordPress control panel that’ll create appropriate shortcode based on a number of simple form options. It couldn’t be easier.

The last problem that we were presented with – knowing full well we’re dealing with pilots – is that keeping the plugin updated would be problematic for most people… particularly when manual updating a plugin usually requires at least a little knowledge of FTP. The only solution was to submit the plugin (that was originally intended exclusively for this post) into the WordPress plugin repository… meaning that you’ll now be able to install the aviation history plugin directly from your WordPress dashboard. You will also be notified of new upgrades and updates in a manner no different to any other of the plugins on your WordPress website.

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

Installing the Aviation History Plugin

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. Find it by navigating to  Plugins  Add New  from the administration menu. You’ll need to search for hiztory – that’s history with a ‘z‘. Since it’s a misspelled word, we’re currently the only result with that specific 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. If life gets all Airbus on you, get in touch and we’ll help!

Settings

Once you click on Activate, you’ll see a Settings menu under the plugin details; you’ll need to select it.

Hiztory Setting from the Plugin Settings Page. Select it.

Alternatively, you will now be able to select the History Shortcode option from your 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 you select.

Hiztory Shortcode Generator

Making History

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

What do I do with this shortcode?

As in the case of all our examples, the generated shortcode should be copied into the text editor of your WordPress website – not the pretty Visual editor… the text editor. WordPress will recognise the shortcode and, based on the code in our plugin, replace it with the result you’ve asked for.

Copy your shortcode into the text editor.

If it doesn’t work straight away – don’t worry. There’s a little section below about enabling shortcodes in widgets areas.

The default output (using the shortcode of [hiztory]) provides us with a single historical aviation event.

History data unavailable for a short time. Check back soon

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

Note that the datetags, or the html formatting for the date, does not include the < or > tag; this is automatically applied with the results. If you are unaware, the tag of ’em’ is for italics and ‘strong’ is bold.

The shortcode will generate the following result:

History data unavailable for a short time. Check back soon

Of course, you can choose not to display results in a list (all multiple results are returned as a list by default). In this case, we’ll format results into a block of text delimited by <br> tags after each event, however, you can change this in the option titled ‘After post HTML‘. If you don’t know what you’re doing – leave it.

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

Retrieving Results for Another Date

By default, when we make a request to the Hiztory API we’ll use the date associated with your own WordPress website. However, at times, 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 of the Plugin

Some other features of the plugin include:

  • Functionality to include results relating to deaths, births and events.
  • Up to 15 results can be rendered in one request.
  • 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 feature globally. Only use it if the shortcode you use doesn’t return results.

Enable/Disable Sidebar Shortcode Support

Aviation History RSS Feed

If you’re a little old school, we have a simple RSS feed that will generate some random aviation history for the current day in history.

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 .

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

The format for the RSS request is as follows:

http://www.hiztory.org/[mm]/[dd]/aviation.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.

Let us know what you think.

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

References:

Download from WordPress | Internoetics | Hiztory | Hiztory API

Shortt URL for this post:

2 comments

  1. Dav

    Hi, i tried to install the plugin in the widget area but it’s not working, the plugin hide any widget starting from his position.. i mean if i put the text widget with the shortcode History data unavailable for a short time. Check back soon in home 3 position 1, the last widget i can see is in the last position of home 2 area.. anyway.. is not working.. :(

    • Marty
      Author

      I’m not quite sure what you mean. You’ll require a filter to enable shortcode in a widget – did you set that option? Please email me screenshots at marty at flight dot org so I can take a look.

Leave a Reply

Your email address will not be published. Required fields are marked *