Tom –
I’ve seen that you’re a fan of Code Snippets, but that only works for code that should work as if it were in a functions.php file. Do you know of a way (plugin, black magic, etc) which will allow php in pages/posts that works well within GeneratePress?
Basically I want to create a way to calculate years since a date. Many of my clients have statements on their sites like “A family owned business for 25 years”. The idea is to automate updating this date.
The code (if it worked within a page) would look something like this for a business which started Feb 11, 1981.
<!DOCTYPE html>
<html>
<body>
We have been in business for <?php $bizstart=new DateTime("1981-02-11");$today=new DateTime();$interval=$today->diff($bizstart);echo $interval->format('%y '); ?>years.
</body>
</html>
Any thoughts?
Thanks!
(other) Tom