creating footnotes in WordPress

Using footnotes when you write is a quick and easy way of giving credit to the source document that you have referenced. Unfortunately WordPress (and most other blogging platforms) do not seem to provide an built in method of adding footnotes although there are WordPress plugins that do the job.

One option is to just code the footnote yourself using html.

footnotes in html

this is what footnotes look like in the browser:

William Shakespeare was the son of John Shakespeare, an alderman and a successful glover originally from Snitterfield, and Mary Arden, the daughter of an affluent landowning farmer [1]. He was born in Stratford-upon-Avon and baptised there on 26 April 1564. His actual date of birth remains unknown, but is traditionally observed on 23 April, Saint George’s Day [2]. This date, which can be traced back to an 18th-century scholar’s mistake, has proved appealing to biographers, since Shakespeare died 23 April 1616[3]. He was the third child of eight and the eldest surviving son [4].


1. Text of footnote 1
2. Text of footnote 2
3. Text of footnote 3
4. Text of footnote 4

and this is what is looks like when coded in HTML:
William Shakespeare was the son of John Shakespeare, an alderman and a successful glover originally from Snitterfield, and Mary Arden, the daughter of an affluent landowning farmer <sup><a id="ref1" href="#fn1">[1]</a></sup>. He was born in Stratford-upon-Avon and baptised there on 26 April 1564. His actual date of birth remains unknown, but is traditionally observed on 23 April, Saint George's Day <sup><a id="ref2" href="#fn2">[2]</a></sup>. This date, which can be traced back to an 18th-century scholar's mistake, has proved appealing to biographers, since Shakespeare died 23 April 1616<sup><a id="ref3" href="#fn3">[3]</a></sup>. He was the third child of eight and the eldest surviving son <sup><a id="ref4" href="#fn4">[4].
1. Text of footnote 1<a title="Jump back to footnote 1 in the text." href="#ref1">&#8617;</a>
2. Text of footnote 2<a title="Jump back to footnote 2 in the text." href="#ref2">&#8617;</a>
3. Text of footnote 3<a title="Jump back to footnote 3 in the text." href="#ref3">&#8617;</a>
4. Text of footnote 4<a title="Jump back to footnote 4 in the text." href="#ref4">&#8617;</a>

footnotes best practice

For a proper footnote, the number (or letter) should be in superscript. For it to scroll to the bottom, where the note is, it needs to be a link. The note at the bottom should also have a link back to the noted text in the body of the work. Here are the tags used, and their purpose (Remember to close the tags by using “/” in the same tag you open with.):

<sup> makes text in superscript.
<a href=”fn1″> creates a link to wherever you put id=”fn1″.
<a href=”#ref1″>↩</a> makes a link back to the reference number, in this case, the first footnote. Wherever id=”ref1″ is, this will create a link to it.
title=”Jump back to footnote 4 in the text.” creates a tip that says the text in the quotes when the user’s mouse hovers over the link.
[The icon ↩ is witten as &#8617; in html.]

footnote plugins

Another option is to use a WordPress plugin and I will cover that in another post.

enabling local web fonts

Every now and then I come across a requirement where a client asks that their website be able to run with limited or no internet connection. This may be because it is being used as an intranet site, or that their internet access is restricted, or for some other reason.

As WordPress can run locally this isn’t a problem except for those instances where the site relies on external resources – such as fonts. As a result it is then necessary to include the font files as part of the WordPress theme and not have to rely on third-party providers like Google Fonts.

Google fonts

It is possible to go to Google Fonts and download the font files that you need. Navigate to Google Fonts and search for the font that you require. Select the weights you want and in the right-hand corner of the screen you will see a small arrow that will allow you to download the font to your computer:

Button to download Google Fonts
Button to download Google Fonts

It is interesting to note that Google Fonts pops up a warning saying that you do not need to download the font to use it on your webpages, which is true, as you can just link to their site, but we are trying to avoid doing that:

Google Fonts Download Warning
Google Fonts Download Warning

The problem with downloading your selected fonts from Google is that all you get are the web fonts. In order to enable local web fonts, you also need to provide the CSS so the browser knows how to use the specific font files. Different browsers use different font types and so you need to serve up all the information about each font in a proper CSS file. Unfortunately, Google Fonts doesn’t generate the CSS for you, but fortunately there is a service that does.

Google webfonts helper

Google Webfonts Helper uses the Google Fonts API to get both the font files and also generates the necessary CSS for everything to work.

So rather than download the fonts directly from the Google Fonts directory is it better to head over the the Google Webfonts Helper website and download them from there.

Once there you can search for the fonts you want and then select the style weights that you require and the CSS will be automatically generated for you.

You can then copy and paste the CSS and download the webfonts zip file:

Download CSS and fonts from Google Webfonts Helper
Download CSS and fonts from Google Webfonts Helper

One tip is that you may want to customize the folder prefix to point to where you are going to store the font files.

Finally …

The final step (if you are using WordPress) is to remember to enqueue the fonts in functions.php

underscores WordPress theme pages

The underscores WordPress template comes with a number of different pages and folders. They are as follows:

pages:

index.php

This page is used to display the main blog page

single.php

This page displays single posts.

page.php

For single pages.

archive.php

For all archive pages including categories, tags, and author archives.

search.php

The search results page.

404.php

The error page.

main elements

  • header.php
  • sidebar.php
  • and footer.php.

folders:

underscores (or _s) also has five folders:

  • inc ~ which has extra template functions and features;
  • js ~ which holds all the JavaScript files;
  • languages ~ translation files;
  • layouts;
  • template-parts ~ which contains the content loops, content-none.php, content-page.php, content-search.php, content-single.php, and content.php