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.
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?
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?
My issue got resolved when I edited the file using PHP file editor, as the supporter asked to use FTP. Thank you!