==ISSUES HAVE BEEN SOLVED==
I am trying to follow the steps within this tutorial//
http://tatiyants.com/how-to-use-wordpress-custom-post-types-to-add-events-to-your-site/
But I’ve come across a Fatal Error after step 2.
Fatal error: Call to undefined function format_date() in /functions.php on line 134
Error Line//
echo format_date($custom["event_date"][0]) . '<br /><em>' .
Content currently in Functions.php//
http://pastebin.com/FvqvE187
What exactly is the issue?
&How can I fix this?
EDIT//
Added
function format_date($unixtime) {
return date("F", $unixtime)." ".date("d", $unixtime).", ".date("Y", $unixtime);
}
to my functions.php to fix the Fatal Error another issue occurred.
Before the error, in the post edit screen there was a Event Detail Metabox. But after this change the box isn’t there any more. It allowed me to add Locations and Times ect. Now I have no way to add this extra information.
It’s clear the new code caused this but why?
EDIT2//
The answer to my 1st edit was simply adding the rest of the code (input boxes ect)
After adding the rest of the code this error pops up within the Event Detail metabox.
Fatal error: Call to undefined function format_date() in /functions.php on line 172
This is line 172//
$ret = '<p><label>Date: </label><input type="text" name="event_date" value="' . format_date(get_event_field("event_date")) . '" /><em>(mm/dd/yyy)</em>';
EDIT3//
All I had to do was remove format_date from line 172 and also remove one of the parentheses at the end. Doing that enables the Event Details again 🙂
Answer for the 1st
Fatal Error//Fatal error: Call to undefined function format_date() in /functions.php on line 134Adding
function format_date($unixtime) {return date("F", $unixtime)." ".date("d", $unixtime).", ".date("Y", $unixtime);
}
at the top of this code//
NOTE:// For some reason I am not sure of adding the code to the bottom didn’t work for me.
Next Edit//
Answer to this
Fatal Error//Fatal error: Call to undefined function format_date() in /functions.php on line 172on this line//
$ret = '<p><label>Date: </label><input type="text" name="event_date" value="' . format_date(get_event_field("event_date")) . '" /><em>(mm/dd/yyy)</em>';Simply remove
format_datetext and ONE parentheses from(event_date")).Now the Event Details are available 🙂