Posted: August 10, 2015 at 5:21 am
|
I want to be able to add a set of ACF values to my tickets (advertising banners in this case). I have created image fields in ACF and assigned them to the events and set the banners per event. …however to call the ACF field values in the ticket message I am not allowed to call the custom shortcode I have created as it is not in the allowed list. How do I add a shortcode to the allowed list? or is there another way to execute PHP in this message (am guessing not which is why I wrote the shortcode). |
Hi Marcus, WP Shortcodes are actually completely separate from the messages shortcodes so it isn’t as easy as setting the shortcode as valid. You would need to register the shortcode within the messages system, register a ‘parser’ so that the messages system knows what function to use to parse the shortcode, then set that shortcode as a valid shortcode within the specific sections within the messages system. Take a look at the FHEE__EE_Shortcodes__shortcodes, FHEE__EE_Shortcodes__parser_after and FHEE__EE_Messages_Validator__get_specific_shortcode_excludes filters within core to see the current message system doing this. Currently custom shortcodes are not a simple feature to add to the messages system yourself. Are you looking to simply add different banners for each event? If so you can do this using Custom message templates. Add the HTML directly to the template and then assign the custom template to the event. Would that work? |
|
|
You are correct, that is far too complicated for me to attempt, ..however the client needs to be able to add images/text to the tickets in an easy to manage fashion from the event editing page, ..and creating a new ticket template for any event is not practical as there may be 400 live events at any one time. Can you think of any other way to get an ACF field or some custom php into a specific point on the ticket message? |
Which message type is it that you looking to do this within? I’ll check with the developers if there are any options for that specific message type, although currently I do not believe there is, other than adding your own custom shortcodes. |
|
|
It is the ticket message. |
Hi Marcus, I created a ticket to include a new shortcode within the main content of the messages templates to pull in event meta fields (which is basically just post_meta) This shortcode will work similar to our other dynamic shortcodes so something like [EVENT_META_*] will be available. You can then add you post meta name to that shortcode which will parse to the value set. For example if you have a post_meta field called some-img-meta-value you would use the shortcode: [EVENT_META_*some-img-meta-value] Which will parse to the value set, meaning you can do something like this – http://take.ms/gKWuC If nothing is set it would return an empty string. ACF saves as post_meta so this should work the same from there. This will be included within the next version of Event Espresso. |
|
The support post ‘Add custom PHP or Custom Shortcode to ticket’ 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.