[Plugin: Query Multiple Taxonomies] Change list-item.html to list-item.php so I can use PHP
-
One of my taxonomies is year of birth. I’d like to be able to use a simple PHP function to show the persons (approximate) age next to the year of birth in my list (year of birth doesn’t change so can be set as a taxonomy, but age changes so it can’t be stored like that), like this:
2000 – 12 years old
1999 – 13 years old
1998 – 14 years old
and so on…The year is the mustache {{name}} variable, the age would be worked out afterwards using a php function.
However, as the list-item template is html I can’t use PHP in it. So, I edited widget.php and changed ‘list-item.html’ to ‘list-item.php’ and changed the names of the template files.
This worked, but now when I try and use PHP in the template my php opening and closing tags are getting converted to comment tags, like this:
<?php ?> <!--? ?-->
I can see in ‘Mustache.php’ that it’s using RegEx to change stuff, but I don’t know much about RegEx.
Do you know how I could edit ‘Mustache.php’ to not convert php tags?
Or, am I going about all this the wrong way, i.e. is there a more simple way to take a mustache variable like {{name}}, check to see if it’s a number (a year), and then use some logic on it to work out the approximate age? I don’t know if mustache has those kind of features or flexibility?
Thanks.
https://www.ads-software.com/extend/plugins/query-multiple-taxonomies/
- The topic ‘[Plugin: Query Multiple Taxonomies] Change list-item.html to list-item.php so I can use PHP’ is closed to new replies.