I’m creating an upcoming event list using custom post types and have moved the page-event_list and single-espresso_event PHP files to my child theme location and made some minor adjustments to get them to display as I’d like.
I have created custom event metaboxes for a event_highlights, event_level and would like to include this information on my custom post types but am having no luck. I have tried using the suggested syntax in my template files:
OK, so that shortcode wont work on anything other than an event.
What you need to do is a little more complex.
In your template (so probably single.php of the theme since you are dealing with posts) you need to add the following or something similar.
$get_ee_post_meta = get_post_meta(get_the_ID(), event_meta, true); //get the meta data from the post
$converted_data = unserialize($get_ee_post_meta); //convert it from serialised data into an array so we can get what we need
//var_dump($converted_data); //just for testing purposes
echo $converted_data['event_level']; //echo out the keys value, so in this case the event_level
echo $converted_data['another_meta_key_name']; // and becuase it has all the post meta in a variable we can pull out whatever we need from it.
// etc etc
You saved my day… Messed with this for much of the day before posting and woke up the next morning, with both my questions answered, and by you. Thanks Dean!
I carry this a bit further and outputted the 6 fields in my custom post types. Works like a charm.
The support post ‘Showing Event Meta in Custom Post Type Template’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.