Tidal Chart for Leith

How to caculate a countdown to the next high and low tide.

First, there is a nice plugin called Tides Today UK and Ireland tide times that allows tidal charts to be displayed using a Sidebar Widget or a shortcode. For example:

[[tide_times days=1 title="Tide times for Leith" location="leith"]These are today's tides for Leith[/tide_times]]

That outputs a tidy forecast like so:

[tide_times days=1 title=”Tide times for Leith” location=”leith”]These are today’s tides for Leith[/tide_times]

The shortcode references the authors own web-service api that returns a JSON encoded dataset. Here is the dataset for Leith. However, the plugin author clearly (if not threateningly) states:

You may not use the data provided by the API for anything other than displaying tide information on your website by the
means provided by this plugin.

…Failure to comply with any of the conditions outlined here or as outlined in the Tides Today Terms and conditions will result in legal action being taken.

In the words of Al Swearengen:

Not a tone to get a deal done.

Even though the datasource provide is from the UK Hydrographic Office:

All data is provided by the UK Hydrographic Office and is provided under license. Crown Copyright 2016.

https://tides.today/about/

So we might need to find our own, tax-funded, public, non-threatening api to get our tidal info from, for example:
https://data.gov.uk/publisher/united-kingdom-hydrographic-office
https://www.tidetimes.org.uk/leith-tide-times
even better:
RSS: https://www.tidetimes.org.uk/leith-tide-times.rss
Twitter: https://twitter.com/LeithTideTimes
http://www.ntslf.org/
https://tidesandcurrents.noaa.gov/api/
https://www.worldtides.info/
https://www.wunderground.com/

The NOAA api looks quite promising… but it’s only for North America. So we move on to Worworldtides api which provides 1000 free calls per month. So far that is a winner. Now let’s take a look at The National Tidal and Sea Level Facility. It seems it only serves the UK and Ireland. Here is Leith.

Leith
http://www.ukho.gov.uk/easytide/EasyTide/ShowPrediction.aspx?PortID=0225&PredictionLength=1

Holy Island
http://www.ukho.gov.uk/easytide/EasyTide/ShowPrediction.aspx?PortID=0208&PredictionLength=1

Archive Pro Matic Highlight Class

Introducing a new attribute for Archive-Pro-Matic: highlight
Highlight accepts the following values:

  • current-year
  • active-year

Assigning ‘current-year’ as the value of the highlight attribute will add a current-year class to the current year in the archive list. Assigning ‘active-year’ would only be assigned to the archive list when placed on an archive page.

Demos

We have added a bit of css to highlight each of the classes:

 .current-year {
    border-left: 2px solid red;
 }

.active-year {
     border-left: 2px solid blue;
 }

current-year

Assigning ‘current-year’ as the value of the highlight attribute will add a current-year class to the current year in the list:

[archives type="yearly" cat_id="4" limit="5" highlight="current-year"/]

active-year

Assigning ‘active-year’ would only be used on the archive page itself. To see this in action, first visit the an archive page, say 2014 and on that page place an archive list using the sidebar widget or following shortcode.

[archives type="yearly" cat_id="4" limit="5" highlight="active-year"/]

Format: Option

Of course this also needs to work with drop downs.

[archives type="yearly" format="option" highlight="active-year"/]

Print-O-Matic and WordPress Charts

Here is an example of using Print-O-Matic to print a WordPress Chart using wp-charts.

[wpcharts type=”piechart” legend=”false” titles=”Title 1, Title 2, Title 3, Title 4″ values=”3,7,5,12″ id=”my_chart”]

[print-me target="%prev%"/]

Works in 2.0.
Pre 2.0:
It seems we need to wrap the chart shortcode in a div so we can target that div and include it’s related javascript.
Still not. maybe we also need to include the chart js on the page?
Nope. It seems the HTML Canvas element is not cloning it’s content that was generated by the javascript… hmmm.

Collapse-O-Matic Inline Trigger with Block Target

Shortcode

This is an example of some text that has a trigger placed inline, meaning that the trigger does not break the flow of the text. However, when this triggerhidden content is clicked and the target is expanded, the target would break the paragraph as a display: block element. Naturally, when the element is collapsed, the inline flow returns.

...However, when [expand tag="span" title="this trigger" targtag="span"]hidden content[/expand] is clicked...

The Roll-Your-Own Method

This is an example of some text that has a trigger placed inline, using the roll-your-own method. However, when this trigger hidden content is clicked and the target is expanded, the target would break the paragraph as a display: block element. Naturally, when the element is collapsed, the inline flow returns.

...However, when <span title="this trigger" class="collapseomatic" id="testme2">this trigger</span><span class="collapseomatic_content" id="target-testme2">hidden content</span>
is clicked...

Limited Time Offer Demo

This is an example of how a limited time offer would work in conjunction with content in a collapse-o-matic expand element.

This demo uses T(-) Countdown Control with a cookie that tracks when the offer expires for each unique visitor. Once the countdown reaches zero, T(-) Countdown Events will remove any special offer items.

For this demo, we’ll set the special timer for just two minutes. The offer will then be removed for 24 hours, and then after the 24 hours are past, the offer will reset.

Details
this is where the details of the special are presented

T(-) Countdown Control – Separating the Time Units

Normally a countdown groups the units of time (weeks, days, hours, minutes and seconds) into a single countdown unit. But what if you wanted to break out these units and have them displayed on different parts of the page?

Step One. We will need to add a new attribute that tells the countdown NOT to display any of the digits. This way all the countdown scripts and details are still loaded, but the countdown is not displayed. Something like:

[tminus cid="123" hidden="true" style="cloud-city"/]

Step Two. A new shortcode will need to be created for displaying the time unit. We will need to know the countdown id (cid) the time unit to be displayed, and the style to be used, if other than the default style set up on the plugin settings. If a custom style is used it must be defined in both the countdown and the units like so:

[[tminus_digit cid="123" unit="hours" style="cloud-city"/]]

The final set will be to modify the countdown script to locate the time units, even if they are not wrapped in a countdown dashboard.

Let’s get started.

Here is a hidden countdown:

Now we add all the digits, starting with weeks:
[tminus_digit cid=”281″ id=”explode” unit=”weeks” style=”cloud-city” omitweeks=”false”/]

Days:
[tminus_digit cid=”281″ id=”explode” unit=”days” style=”cloud-city”/]

Hours:
[tminus_digit cid=”281″ id=”explode” unit=”hours” style=”cloud-city”/]

Minutes:
[tminus_digit cid=”281″ id=”explode” unit=”minutes” style=”cloud-city”/]

Seconds:
[tminus_digit cid=”281″ id=”explode” unit=”seconds” style=”cloud-city”/]