Posted: June 10, 2016 at 4:19 pm
|
Is there a way for me to add in my own shortcodes to the the messages? I have a purchase code that is not related to the registration code. |
Hi there, Yes it is possible to add your own shortcodes to the messages system, I have previously posted details of doing so here: https://eventespresso.com/topic/venue-against-each-date/#post-177488 Or you can view the code here: |
|
|
I’ve added the two snippets of code to my functions file and they still don’t work. Where do I need to put this code? Currently I had it in the child theme functions file. I moved it to the parent, and then my site loaded a blank page when using the example code. What am I doing wrong? |
|
Ok I got it to show up (missing semicolon on my end). Since it’s showing up in the DateTime list, what is the name for the Attendees List section? I thought it would be EE_Attendee_Shortcodes, but it wasn’t. |
|
Can you also run do_shortcode() within your shortcodes to trigger one of your shortcodes? |
|
I got the shortcode to register correct, but nothing is being returned. It’s only showing the bracket shortcode. [DRIVERSED_SHORTCODE] |
Can you either create a Gist or post your code to something like http://pastebin.com/ and post the URL here so I can view the code please? If its returning the string it sounds like there is no parser for the shortcode. |
|
|
I got it to parse correctly if I just kept it to the EE_Datetime_Shortcodes instance, but as soon as I changed those to EE_Event_List_Shortcodes, it wasn’t parsing correctly. Any suggestions? |
Your parse function is different from your hook:
The reason the shortcode won’t work with that setup is $data will never be an instance of EE_Event_List (there is no EE_Event_List class) remove the instanceof check:
And fix the hook function name, then that shortcode will parse within the event list shortcodes.
No you can’t, do_shortcode() runs on standard shortcodes and EE message shortcodes are not apart of the WP Shortcodes. Any EE data you need can but pulled in using the $data variable, it will be different depending on the shortcode your are parsing but for EE_Eent_list_shortcodes data will be passed a You’ll need to go through and find the data available from the EE_Messages_Addressee class and call whatever it is you need from there. You can use Kint and use For example on your shortcode you can use:
To display the first name of the primary registrant. Can I ask why you are using the event list shortcodes? Where do you want the output to be and what details do you want to use? |
|
The support post ‘Custom shortcodes in messages’ 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.