Posted: December 28, 2018 at 12:44 pm
ACF Shortcodes are used in the Description field of the Event post. 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? |
|
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: https://iclega-attend.org/events/child_protection_seminar_2019/ Is this section from ACF? – http://take.ms/emddm 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. |
|
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? |
|
Use this snippet: https://gist.github.com/Pebblo/d0d5f485ae0599e56e20 You can add that to a custom functions plugin on your site, we have some documentation on creating one here: https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/ Then change this line: https://gist.github.com/Pebblo/d0d5f485ae0599e56e20#file-tw_custom_upcoming_events_widget-php-L379 To be: 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?
|
|
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. |
|
The rendering is occurring but it appears the data is all based on the record which is in the main part of the page… |
|
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
|
|
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! |
|
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.