Home Forums Event Espresso Premium ACF shortcodes not rendering in Event Espresso sidebar

ACF shortcodes not rendering in Event Espresso sidebar

Posted: December 28, 2018 at 12:44 pm


December 28, 2018 at 12:44 pm

ACF Shortcodes are used in the Description field of the Event post.
Description is turned on in the sidebar as a display field.
The field shows unrendered ACF shortcodes, not the expected data.
How can I overcome this?


You will see the | pipes on the left and where they are in the acf shortcodes in the sidebar in this example.

Am I outside of “the loop”? How does one get back in the loop?


  • Support Staff

December 28, 2018 at 1:59 pm

Hi there,

The widget doesn’t parse shortcodes by default, so you’ll need to make a change to the code used.

However, to clarify, on this event:

Is this section from ACF? –

Or is it set within the excerpt?

The reason I’m asking is the numbers show on the widget for that event, which doesn’t really make sense if those are coming from ACF.


January 2, 2019 at 7:29 am

I had typed in those values manually in the description field: for that event they are not coming from ACF.

What changes will I need to make to the code in order for the widgets and for the listing page to show the ACF values per record?


  • Support Staff

January 2, 2019 at 9:11 am

Use this snippet:

You can add that to a custom functions plugin on your site, we have some documentation on creating one here:

Then change this line:

To be: echo '<p style="margin-top: .5em">' . do_shortcode($desc) . '</p>';

Then, go to Dashboard -> Widgets.

The snippet I gave you adds a new widget called ‘Custom Event Espresso Upcoming Events’, use that in place of the original so that you can edit the code used (because it’s now in your custom plugin).

Does it work for you then?

  • This reply was modified 5 months, 2 weeks ago by  Tony.


January 2, 2019 at 11:37 am

I have a couple of custom plugins I have made, and I think I will just add this code to the “general” one since this is a global thing I want to happen all the time. I will circle back when I have tested and launched. Thanks.


January 2, 2019 at 12:28 pm

The rendering is occurring but it appears the data is all based on the record which is in the main part of the page…
I was hoping to get values from each record for each record shown in the list.
The values all appear to come from record 10103, not the respective records in the list…in the sidebar.


  • Support Staff

January 3, 2019 at 5:46 am

Yeah, the reason is that ACF is using the global post object to parse the shortcode, which at that time is the single EE event post.

Can you not use the ACF function get_field() to pull the value directly within the widget?

The other option is to pull the post object and replace the global $post object in the loop, then reset it when finished.

global $post;
$post = get_post($event->ID());

//output the content



January 3, 2019 at 9:12 am

Wow. I updated that and is seems to be working. I will test this a bit and let you know if I need more guidance. Thanks!


  • Support Staff

January 3, 2019 at 9:31 am

You’re most welcome.

The support post ‘ACF shortcodes not rendering in Event Espresso sidebar’ 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.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Tony 5 months, 2 weeks ago ago

Topic Tags


This topic is: not resolved
Do NOT follow this link or you will be banned from the site!