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:
- Custom fields
- Options pages
- Advanced Custom Fields
- Metabox
- ACPT
- CubeWP
- Query parameters
- User info / meta
- Author meta
- Custom hook
- Custom functions
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