For a gym website, I'm making them have a members area where users can view Nutrition plans that have been created for them.
I check what Nutrition plans are available using "the_slug_exists".
eg.
if (the_slug_exists("nutrition-plan-$userid")) { // show link to nutrition plan 1 }
and
if (the_slug_exists("nutrition-plan-$userid-2")) { // show link to nutrition plan 2 }
This works fine but currently, I can only name them generically (Nutrition plan 1, Nutrition plan 2, etc.)
Is there a way of getting more information from inside the post? Like when it was published, or one of the other fields, just with the URL.
If not maybe I can find another way of relating those custom post types to each user in a way that I can access post data from them.
Thanks in advance for any help
I figure it out...
$thisurl = 'https://evolvefitness.co.uk/nutrition-plans/nutrition-plan-'.$userid;
$npid = url_to_postid($thisurl);
echo get_the_date('d/m/y', $npid);
hope that will help someone