Skip Navigation

[Resolved] Display age with Years, days old.

This support ticket is created 4 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by harwinderS 4 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#2040043
Screenshot 2021-05-03 024453.png

Tell us what you are trying to do?
- I have a custom post type, 'Politician,' and the post type has the custom field 'date of birth'. I want to display the politician's age in Years, days old, using the 'views' in the sidebar. But when I tried to use the solution from the link shared below, I cannot save changes in the functions.php, as it displays an error, the image of the error is attached.

Is there any documentation that you are following?
https://toolset.com/forums/topic/calculate-age-from-date-of-birth-custom-filed/#post-164510
Is there a similar example that we can see?
https://toolset.com/forums/topic/calculate-age-from-date-of-birth-custom-filed/#post-164510 - this is what I am looking to do.
What is the link to your site?
My site is under development, but I have attached a copy of the error I am facing.

#2040105

Hello, I don't see a problem with the code here. I copied the code and pasted it in my own custom theme, and I don't see the same error. Maybe there is an issue in the file outside of the visible editor area that is causing a problem in this code?

Does the file begin with the standard PHP tag?

<?php

That is required. Or perhaps there is a problem in the theme editor page of wp-admin that is preventing updates to this file. If you edit the functions.php file on your desktop and upload it using FTP, are any PHP errors shown on the live site?

#2040151

My issue got resolved when I edited the file using PHP file editor, as the supporter asked to use FTP. Thank you!