Dynamic template tags

tdrayson

For a client website I was building, I wanted a way to be able to dynamically insert dynamic data into sentences.

GeneratePress has a built in template tag for the current year – {{current_year}} which can be used in the footer of your website.

The tutorial below shows you how to create and insert your own custom template tags. This includes:

I can add support for other custom field plugins, drop me an email and I can get them added for you.

Demo

Kyle from The Admin Bar created a video showcasing how powerful this solution is.

1. Creating our template tag function

Add the function below to functions.php or code snippet plugin

Members content only

Become a SnippetClub member to gain instant access to this tutorial plus tons more premium content.

Already a member? Log in below.

Login Form

👋🏻 Weekly Tutorial Digest

I send out a weekly newsletter with links to new tutorials written in the last week, you can subscribe below.

Newsletter

🔒I won't send you spam, I promise