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.
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
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.
Install Now … then
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!
Once you click on
Activate, you’ll see a
Settings menu under the plugin details; you’ll need to select it.
Alternatively, you will now be able to select the
History Shortcode option from your Settings menu.
The Hiztory shortcode generator is a form that’ll construct shortcode based on the (non-default) options you select.
By clicking on
Get Shortcode at this point we’ll just generate default usage by way of nothing other than the
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.
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.
A military plane of Antonov model has crashed in the Sana'a, capital of Yemen, killing all 10 people on board included five military officers. - 21st November 2012
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"]
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:
- China Eastern Airlines Flight 5210, a Bombardier CRJ200, stalls and crashes near Baotou, China shortly after takeoff because of frost contamination; all 53 on board and two people on the ground are killed. - Sun 21st Nov, 2004
- The first ever RAF air-to-air refuelling of a fully-loaded passenger carrying transport aircraft. It was carried out on a trooper flight to Oman as part of Exercise Saif Sareea. The refuelling took place over Sicily as part of the 4,200 mile, 9 h flight. - Fri 21st Nov, 1986
- JetBlue Flight 1329: An Embraer E190, taxis to its gate after landing at Baltimore-Washington International Airport in Anne Arundel County, Maryland, a fire breaks out in one of its engines. After the airliner reaches its gate, everyone on board evacuates the plane uninjured via the jetway while firefighters douse the fire. - Wed 21st Nov, 2012
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.
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.
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:
The format for the RSS request is as follows:
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.
Shortt URL for this post: