Support

Home Forums Event Espresso Premium Display content of "Advanced Custom Fields" on single event page

Display content of "Advanced Custom Fields" on single event page

Posted: December 13, 2016 at 8:20 am

Viewing 7 reply threads


faeger

December 13, 2016 at 8:20 am

Hi there

First I need to congratulate you guys to your amazing plugin. So, congrats :-)!

My question: I just created some custom fields which are displayed on the backend-create-event-page. Let’s take one of em and call it: “Age”.

If now I create event, I can see the beforehand created custom field and can input something like: “from 8 to 12 years”. So far so good.

Now I’m struggling while trying to display this specific field on the single-event page. I’d like to have a sidebar-like “Event details”-list where all those custom fields and their respective content would appear.

I tried to accomplish your tutorial (https://eventespresso.com/wiki/add-sponsors-section-events-using-advanced-custom-fields/) but cannot get it work.

I’d appreciate every clue but would be endlessly thankfull for a step-by-step-tutorial just for this case.

Thx, Cheers and have a great day!
Philip


Tony

  • Support Staff

December 13, 2016 at 8:38 am

Hi Philip,

Thank you for the feedback 🙂

Before moving further, it sounds like your adding custom fields through ACF that would normally be registration questions, Age being a great example.

Can I ask why you can’t not add these fields within the EE registration form rather than through ACF?


faeger

December 13, 2016 at 9:05 am

Hi Tony

Thx for your reply. Great question: the “Age” is not given by the customer, as it only indicates, within which age range the course can be applied to.

So for example the event-creator organizes a circus-week for kids, the event meta “Age” should then display the age range “5 to 8” or similar.

Thats why I’m using AFC. I hope it’s the right way… I just tried to accomplish things by using the [EVENT_META_*{meta_key}] shortcode but it doesn’t work when I enter [EVENT_META_*{age}]…

Any clue?
Cheers
Philip


Tony

  • Support Staff

December 13, 2016 at 9:15 am

Ok, that makes sense, but…

[EVENT_META_*] is a EE messages shortcode, so are you trying to dipslay the details within a message above or the single event output?

To be clear with that shortcode, if the meta_key was ‘age’, the shortcode would be:

[EVENT_META_*age]

But again, that’s for the EE messages, it won’t work on the single event page, so it depends where you are.

You can get the meta key within the single event output using get_post_meta(), EE also has a wrapper function for this if you have the EE_Event object already.

Can you post the code you are currently using to output the details? it may help to point you in the right direction.

When posting code we recommend creating a gist or using something like pastebin and posting the link here to view, the forum adds formatting.


faeger

December 13, 2016 at 9:28 am

…I’m a bit confused now. Isn’t a “custom field” the same as “event meta”?

What I’m trying to do is:

1. Add a custom field “Age” over ACF
2. Create new event and fill in “Age”.
3. Use [EE_META type=”event_meta” name=”age”] to display it in the Avada-default-blog-sidebar.
4. Assign the “Sidebar”-template as default template for single event-pages.

I don’t know exactly what you mean by EE_Event object? I’m not a programmer, so that’s that 🙂

Thx for your help, I appreciate it!
Philip


faeger

December 13, 2016 at 9:29 am

btw: Thx for your reply, I then found the before mentioned other shortcode… but still it doesn’t work.


Josh

  • Support Staff

December 13, 2016 at 10:52 am

Hi Philip,

You’ll actually need to use the Advanced Custom Fields the_field() function (or equivalent) to display information from a theme template. [EE_META type="event_meta" name="age"] is not a valid short code for EE4.


faeger

December 13, 2016 at 2:28 pm

Hi Josh

Oh… darn! Of course… Just googled “afc shortcodes” and got “[acf field="alter"]” – it works!

Thx Josh!
Cheers
Philip

Viewing 7 reply threads

The support post ‘Display content of "Advanced Custom Fields" on single event page’ 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