Support

Home Forums Event Espresso Premium Custom Post Type (CPT) data in event details?

Custom Post Type (CPT) data in event details?

Posted: January 30, 2018 at 5:02 pm


CONSERVE

January 30, 2018 at 5:02 pm

I would like to include CPT (custom post type) data in the description text of event details. I managed to setup an Advanced Custom Field using the “Post Object” field type. I can even select the existing objects as an editor on the event details page.

However, I have no clue how to get this object (or certain fields of that object) rendered in the description text? The shortcode [acf field="myfield"] throws an error and probably doesn’t work for field type “Post Object”.

I find a lot of discussions in the forum about how to include EE4 data in CPTs but not the other way around… include CPT data in EE4 event details.

Thanks a lot for any hints!


Tony

  • Support Staff

January 31, 2018 at 2:11 am

Hi there,

Can you let me know what custom post type data is?

Event Espresso events are a custom post type, as in they are WP Post with a ‘type’ of ‘espresso_events’ and that’s essentially all that a ‘custom post type’ is.

As you are using ACF I’m assuming you mean you want to display custom fields from the EE event within the description of that event but it is not that clear above so can you provide more details of the what data it is your trying to pull, please?


CONSERVE

January 31, 2018 at 4:45 am

Goal: We have a lot of events with the same description text, but across different locations. Therefore, we need to create let’s say 100 individual events, all with the same description text, title, ticket prices, …
Since all this information is the same (except the location), we want to manage the data at a central place.

Therefore, we installed the Custom Post Type UI Plugin (https://de.wordpress.org/plugins/custom-post-type-ui/) and create a custom post type called “workshop”. Using Advanced Custom Fields, we can
1. Structure the data in the CPT type “workshop” (title, description, price, image, ….)
2. Hook a “selector field” into the “event details” editor, where the author can link/reference a specific object from the “workshop” CPT.

Now we just want to get this data (e.g. using shortcodes) into the description of an envent.


Josh

  • Support Staff

January 31, 2018 at 12:07 pm

Hi there,

You can use the ACF shortcode within the event description, but you’ll need to include the post ID of the related workshop post. For example, if there’s a related workshop post with ID 38153, your shortcode in the event description will look like this:

[acf field="field_name" post_id="38153"]

The support post ‘Custom Post Type (CPT) data in event details?’ 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  Josh 3 months, 3 weeks ago ago

Topic Tags

Notifications

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