Support

Home Forums Event Espresso Premium How to Display EE_META if they exist

How to Display EE_META if they exist

Posted: September 19, 2013 at 7:03 am


Giovanni Barsanti

September 19, 2013 at 7:03 am

Hi guys,
I need to add this feature on the espresso_table.php file

We have some events that run over two weekends, and I would like to show in the date time both dates. I mean, for ex:

2 Weekends Event – Feb 15/16 and Feb 22/23 – from 09.00am to 7.30pm – book

I can use the EE_META to add the “and Feb 22/23” part.. but I don’t want to edit the actual table layout, where the dates for the other events are shown in this way :

Week event – Feb 17 to Feb 21 – from 09.00am to 7.30pm – book

I assume I can do that using a “if – else” cycle.. But I need help to do the syntax:
actual code :

<?php echo event_date_display($event->start_date, $format = 'M d') ?> to <?php echo event_date_display($event->end_date, $format = 'M d') ?>

My idea is something like this :


<?php
if (!empty($event_meta['SECOND_DAY'])) {
<?php echo event_date_display($event->start_date, $format = 'M d') ?>/<?php echo event_date_display($event->end_date, $format = 'd') ?> - <?php echo do_shortcode('[EE_META type="event_meta" name="SECOND_DAY"]'); ?>
} else {
<?php echo event_date_display($event->start_date, $format = 'M d') ?> to <?php echo event_date_display($event->end_date, $format = 'M d') ?>
}
?>

Before trying to destroy the website.. It’s better to ask you if it can works.. 🙂

Thanks!


Dean

September 20, 2013 at 4:29 am

Try this

<?php echo event_date_display($event->start_date, $format = 'l, M d, Y'); $tt = unserialize($event->event_meta); echo $tt['SECOND_DAY']; ?>


Giovanni Barsanti

September 20, 2013 at 7:07 am

Thanks Dean,
I’ve used your snippet but with some modifications, because it wasn’t working.

If you need it (fixed) as future reference for other users, please feel free to ask.

Thanks again,
G.

The support post ‘How to Display EE_META if they exist’ 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.

Event Espresso