Skip to content

About

A simple way to add footnotes using WordPress shortcodes.

Resources

Stars

1 star

Watchers

1 watching

Forks

 
 

Latest commit

 

History

30 Commits

Folders and files

Repository files navigation

Simple Footnotes

  • Contributors: mcaskill, nacin
  • Tags: footnotes, endnotes, shortcode, references
  • License: MIT
  • Requires PHP: 7.4
  • Requires at least: 6.3
  • Tested up to: 6.9
  • Stable tag: 2.0.0

A simple way to add footnotes using WordPress shortcodes.

Description

A simple shortcode solution for adding elegant and semantic footnotes to your WordPress posts and pages.

The plugin is a fork of Andrew Nacin's Simple Footnotes and provides various enhancements over the original.

Features

  • Updated for the latest versions of WordPress
  • Integrated support for TinyMCE (based on Andrew Patton's extension)
  • Localized the plugin
  • Added hooks for customizing the rendering of the shortcode
  • Added [reflist] shortcode for customizing where footnotes are displayed
  • Added support for named footnotes, [ref name="foo"], to cite the same source more than once
  • Added support for grouped footnotes, [ref group="baz"], to customize marker labels and organize types of footnotes
  • Refactored PHP code for PSR-friendliness
  • Added support for Composer

Basic Usage

Citations or notes are inserted inside the [ref]…[/ref] shortcode.

Example #1[1]

[WordPress] was released on May 27, 2003, by its founders, Matt Mullenweg[ref]Mullenweg, Matt. "WordPress Now Available". WordPress. Published on May 27, 2003.[/ref] and Mike Little,[ref]Changeset #8. Timestamp: 2003-04-21 21:37:11.[/ref] as a fork of b2/cafelog.

The above example will output:

[WordPress] was released on May 27, 2003, by its founders, Matt Mullenweg1 and Mike Little,2 as a fork of b2/cafelog.

Notes

  1. Mullenweg, Matt. "WordPress Now Available". WordPress. Published on May 27, 2003. ↩
  2. Changeset #8. Timestamp: 2003-04-21 21:37:11. ↩

The content inside the [ref]…[/ref] will show in the reference list. The [ref] shortcode can be added anywhere a footnote is needed.

Requirements

Prerequisite How to check How to install
PHP >= 5.5.x php -v php.net
WordPress >= 4.x wp core version wordpress.org

Installation

Via Composer

$ composer require mcaskill/wp-simple-footnotes

Via WordPress Admin Panel

  1. Download the latest zip of this repo.
  2. In your WordPress admin panel, navigate to Plugins → Add New.
  3. Click Upload Plugin.
  4. Upload the zip file that you downloaded.

Activation

Then activate the plugin via wp-cli.

$ wp plugin activate simple-footnotes

Or through the WordPress admin panel (Plugins → Simple Footnotes → Activate).

Advanced Usage

Using the reference list shortcode[2]

Once any number of footnotes have been added to the content and the post is saved, the plugin takes care of generating and numbering the reference list. By default the list is rendered in your theme, below the content in a section titled "Notes".

This can be overriden by adding [reflist] wherever the list is desired in your content. This allows you to customize the section and provide your own title on a per-post basis.

If you paginate your posts, you can optionally move your footnotes below your page links. Look under Settings → Reading. Footnotes will still appear as normal for posts that are unpaginated.

Example #2[1]

[WordPress] was released on May 27, 2003, by its founders, Matt Mullenweg[ref]Mullenweg, Matt. "WordPress Now Available". WordPress. Published on May 27, 2003.[/ref] and Mike Little,[ref]Changeset #8. Timestamp: 2003-04-21 21:37:11.[/ref] as a fork of b2/cafelog.

References

[reflist]

The above example will output:

[WordPress] was released on May 27, 2003, by its founders, Matt Mullenweg1 and Mike Little,2 as a fork of b2/cafelog.

References

  1. Mullenweg, Matt. "WordPress Now Available". WordPress. Published on May 27, 2003. ↩
  2. Changeset #8. Timestamp: 2003-04-21 21:37:11. ↩

A reference list can be split into columns.

[reflist columns="20em"]

Using multiple reference lists[2]

A post can have more than one reference list. Each instance of [reflist] will display the notes preceding it.

Using a footnote more than once[2]

You can cite the same source more than once by using named footnotes. The syntax to define a named footnote is:

[ref name="foo"]The quick brown fox jumps over the lazy dog[/ref]

To invoke the named footnote:

[ref name="foo"]

List-defined references[2]

The quick brown fox jumps over the lazy dog.[ref name="LazyDog"] Amazingly few discotheques provide jukeboxes.[ref name="Jukeboxes"] How razorback-jumping frogs can level six piqued gymnasts.[ref name="JumpingFrogs"]

[reflist]
[ref name="Jukeboxes"]This is the jukeboxes reference.[/ref]
[ref name="LazyDog"]This is the lazy dog reference.[/ref]
[ref name="JumpingFrogs"]This is the jumping frogs reference.[/ref]
[/reflist]

Embedding references[2]

The quick brown fox jumps over the lazy dog.[ref group="nb"]A footnote.[ref]A reference for the footnote.[/ref]``[/ref]

Notes

[reflist group="nb"]

References

[reflist]

The above example will output:

The quick brown fox jumps over the lazy dog.[nb 1]

Notes

  1. A footnote.[1] ↩

References

  1. A reference for the footnote. ↩

Predefined groups[2]

There are several predefined groups that style the appearance of footnote markers.

Group name Footnote shortcode Reference list shortcode Sample labels
none [ref]…[/ref] [reflist] 1 2 3 4 5 6 7 8 9 10
lower-alpha [ref group="la"]…[/ref] [reflist group="la"] a b c d e f g h i j
upper-alpha [ref group="ua"]…[/ref] [reflist group="ua"] A B C D E F G H I J
lower-roman [ref group="lr"]…[/ref] [reflist group="lr"] i ii iii iv v vi vii viii ix x
upper-roman [ref group="ur"]…[/ref] [reflist group="ur"] I II III IV V VI VII VIII IX X
lower-greek [ref group="lg"]…[/ref] [reflist group="lg"] α β γ δ ε ζ η θ ι κ

Changelog

1.0.0

  • Updated for The Modern Age.

0.4.0

  • If you paginate your posts, footnote numbering will now remain consistent across pages (e.g., each page does not start with 1)

0.3.0

  • If you paginate your posts, there's now an option under Settings > Reading that enables you to move the footnotes below your page links. Footnotes will still appear as normal for posts that are unpaginated.

0.2.0

  • Release.

Upgrade Notice

0.4.0

If you paginate your posts, this version will allow footnote numbering to remain consistent across pages (e.g., each page does not start with 1)

0.3.0

If you paginate your posts, this version enables you to move the footnotes below your page links. Footnotes would still appear as normal for posts that are unpaginated.

Other Notes

  1. [a] [b] Text in examples from "WordPress." Wikipedia: The Free Encyclopedia. Wikimedia Foundation, Inc. 16 May 2016‎.
  2. [a] [b] [c] [d] [e] [f] Upcoming features‎.

About

A simple way to add footnotes using WordPress shortcodes.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages