- Messages
- 1
- Likes
- 0
- Points
- 1
Hi Guys
The blog posts on my site are player profile pages where I use your plugin to display their current ages, using snippets like this:
I am currently doing a new snippet for each player, changing their dates of birth as appropriate. This means I have hundreds of snippets now created, with many more to go.
I have looked at the "Available Attributes" section of the Edit php snippet screen and was wondering if this could be used to create one single snippet where I add the date on the blog page with the snippet shortcode, rather than create separate snippets. I have tried but can't make it work - I am not a coder, so I don't know if it's me doing something wrong, or if I have just totally misunderstood what the Available Attributes section actually does.
Thanks!
The blog posts on my site are player profile pages where I use your plugin to display their current ages, using snippets like this:
Code:
$dateOfBirth = "01-08-1988";
$today = date("Y-m-d");
$diff = date_diff(date_create($dateOfBirth), date_create($today));
echo $diff->format('%y').' years';
I have looked at the "Available Attributes" section of the Edit php snippet screen and was wondering if this could be used to create one single snippet where I add the date on the blog page with the snippet shortcode, rather than create separate snippets. I have tried but can't make it work - I am not a coder, so I don't know if it's me doing something wrong, or if I have just totally misunderstood what the Available Attributes section actually does.
Thanks!