WordPress Header Anchor Link on Hover Automatically

Today I needed to add an anchor link dynamically to every header tag (h1, h2, h3, etc.) in this WordPress site.

I do this, because I like to link directly to header tags in my blogs from time-to-time.

The code was mostly copy-and-pasted from here.  I edited that code to include a FontAwesome link icon with help from here.

And then I wrapped it all up in a tidy plugin for y’all!

Hover here for an example of a H3 with the automatic hover link (on the left!).

Features:

  • Enqueues & loads FontAwesome 4.7.
  • Just turn it on – No settings!
  • Works with Github Updater out of the box!

Download the brand new Auto Header Anchor Links plugin!

Let me know if you have ideas for improvement.

Posted in

Toby Cryns

Toby Cryns is a freelance CTO, expert WordPress developer, and teacher.

He offers free advice to improve your freelance biz.

He also publishes small droppings every now and them to https://twitter.com/tobycryns and https://twitter.com/themightymo.com

Follow Toby's contributions on Github and WP.org.