Posted: October 6, 2014 at 10:50 am
|
Hello there, I cannot seem to have a short code execute from within a text widget – is this actually possible? Apologies if I have missed something obvious. Cheers, Spencer |
Hi Spencer, Shortcodes within widgets needs a small snippet of code to enable them to work. add_filter('widget_text', 'do_shortcode'); You can add that to your themes functions.php file or a site specific plugin Check here for more info: |
|
|
Hi Tony, Thanks for getting back – that’s a nifty bit of code, thanks. Is it possible to add an excerpt to an event that I could then display within the events short code? |
Which events shortcode are you using? If you go to Event Espresso -> General Settings -> Templates (tab). You should see ‘Display Description’, what is that currently set to? |
|
|
Thanks Tony, that was the section I was missing. I have two staff members at present, but the generic short code is not displaying either of them: [ESPRESSO_STAFF] If I add an ID, that staff member will display: [ESPRESSO_STAFF id=”1″] How do I get them to all display? Cheers, Spencer |
Where/how are you using the [ESPRESSO_STAFF] shortcode? ESPRESSO_STAFF uses the event_id to display all staff members for that event, this can either be set within [ESPRESSO_STAFF event_id={$event_id}] or the Event Espresso pages set a global $this_event_id for each event which will be used if set. I’m guessing you are currently using the shortcode within a standard wp page? If so you’ll need to set the event_id within the shortcode. |
|
|
Ah right, I get that now. I was trying to display a list of all staff managers on the same standard page. Is there any way to do this? Cheers, Spencer |
Hi, the shortcode pulls the information from each event so this should work on a WordPress page (adding a shortcode for each event): [ESPRESSO_STAFF event_id=”1″] — |
|
|
Thanks Lorenzo, I thought there was a way to pull the managers in via an array rather than put a short code in for each. That’s cool now I know. Cheers, Spencer |
|
As an extra thought, is there a template code that could do this? |
|
Hi, First off you can use It’s not based on events but the staff ID. https://eventespresso.com/wiki/shortcodes-template-variables/#staff Regarding template wise, the only way to achieve it would be to create a custom function that basically pulls the information out of the database directly, there isn’t a shortcode to loop though all staff like that. |
The support post ‘Shortcodes into text widgets’ 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.