Support

Home Forums Event Espresso Premium ACF shortcodes not rendering in Event Espresso category list page

ACF shortcodes not rendering in Event Espresso category list page

Posted: January 4, 2019 at 12:16 pm


ICLE

January 4, 2019 at 12:16 pm

I suspect the solution is exactly like the earlier topic, but looking for the code location of the loop to encompass for this page listing:

https://iclega-attend.org/event-category/live/

Link to image of page

and any other “event-category” that we dream up eventually.

Thanks.


Tony

  • Support Staff

January 9, 2019 at 7:15 am

One way to avoid having to mess around with the global $post variable (which should already be set up in the above page) is to add the post_id parameter to your ACF shortcodes so that ACF always knows which post the shortcode is for, right now it has to rely on the global post but as you are finding that’s not always set to a WP_Post object.

So for example [acf field="test_field" post_id=101]

However, having said that, most themes would usually use the_loop for the above and so would normally setup the global $post object for this to work out of the box, you’re using a child theme of twentyseventeen which I know does use the loop.

The reason your post doesn’t output the ACF values there is because EE is set to use the short description/exceprt on the event lists, which strips out shortcodes.

Go to Event Espresso -> Events -> Templates -> Event list pages -> Display Description

Set that to full description and EE will output the ACF values.


ICLE

January 18, 2019 at 8:51 am

Great explanation. Noted and tested. Thanks.


ICLE

January 18, 2019 at 8:57 am

The search results page suffers a similar fate.
https://iclega-attend.org/?s=10172

Only the pipes show up, no values. I have put the id in the acf reference.
[acf field="cle_value_main" post_id=716] | [acf field="cle_value_ethics" post_id=716] | [acf field="cle_value_professionalism" post_id=716] | [acf field="cle_value_trial_practice"post_id=716 ]


Tony

  • Support Staff

January 18, 2019 at 10:21 am

That’s actually nothing to do with Event Espresso, your theme is outputting the post excerpt using the_exceprt().

the_exceprt() removes any shortcodes when auto generated from the content, this is from the codex:

An auto-generated excerpt will also have all shortcodes and tags removed. It is trimmed down to a word-boundary and the default length is 55 words.

So it’s basically the same answer as above only this time its content that EE doesn’t control.

What you could do is copy your themes search.php file into your child theme and then change this line:

get_template_part( 'template-parts/post/content', 'excerpt' );

To this:

get_template_part( 'template-parts/post/content');

Which should output the full post content rather than the excerpt.


ICLE

January 18, 2019 at 12:27 pm

This reply has been marked as private.


Tony

  • Support Staff

January 18, 2019 at 12:46 pm

You’re most welcome 🙂

You must be logged in to reply to this support post. Sign In or Register for an Account

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: publish

Updated by  Tony 1 day, 13 hours ago ago

Topic Tags

Notifications

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