Home Forums Event Espresso Premium the_meta() in widget

the_meta() in widget

Posted: April 26, 2016 at 1:49 pm


April 26, 2016 at 1:49 pm

I would like to include some custom fields, because I need to include a “boat type” with the event.
the_meta() tag works in the single page, event overview etc.
But not in the widget, if I simply put “echo the_meta()” in the widget template I get printed out “Array”, and if I put “echo the_meta($event->ID());” i get this string: “switch_like_status: 1, 1, 1, 1, 1, 1”.

Any help?


  • Support Staff

April 26, 2016 at 3:21 pm

Hi there,

It turns out that the_meta() must be used from within The Loop or in a theme file that handles data from a single post (e.g. single.php).

You can use get_post_meta() in the widget template:


April 28, 2016 at 2:19 pm

I tried to read the data in the widget template like you said with get_post_meta(), but it still doesn’t work …
My code: <?php echo '<li class="boat">' . '<span>Boat:</span>' . get_post_meta($post->ID, 'Boat', true); ?>


April 28, 2016 at 2:21 pm

It doesn’t even work with the advanced custom fields plugin ( …
You can’t even update the fields if you add one the the event post type :/


  • Support Staff

April 28, 2016 at 2:47 pm

Hi there,

When you use $post->ID, WordPress will try to get the custom field for Boat for the current WordPress post (or page). Instead, you use the event ID, like this:

echo '<li class="boat">' . '<span>Boat: </span>' . get_post_meta( $event->ID(), 'Boat', true );

I haven’t run into any issues with using Advanced Custom Fields on Event Espresso events, but your mileage may vary depending on the active WordPress theme and if there’s another plugin adding any scripts to the editor.

The support post ‘the_meta() in widget’ 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.

Do NOT follow this link or you will be banned from the site!