Support

Home Forums Event Espresso Premium Shortcodes into text widgets

Shortcodes into text widgets

Posted: October 6, 2014 at 10:50 am

Viewing 10 reply threads


Spen

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


Tony

  • Support Staff

October 6, 2014 at 11:30 am

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:

http://digwp.com/2010/03/shortcodes-in-widgets/


Spen

October 6, 2014 at 11:49 am

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?


Tony

  • Support Staff

October 6, 2014 at 11:55 am

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?


Spen

October 7, 2014 at 9:30 am

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


Tony

  • Support Staff

October 7, 2014 at 9:59 am

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.


Spen

October 7, 2014 at 10:04 am

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


Lorenzo Orlando Caum

  • Support Staff

October 7, 2014 at 10:48 am

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″]
[ESPRESSO_STAFF event_id=”2″]
[ESPRESSO_STAFF event_id=”3″]


Lorenzo


Spen

October 7, 2014 at 11:09 am

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


Spen

October 7, 2014 at 11:10 am

As an extra thought, is there a template code that could do this?


Dean

October 8, 2014 at 3:21 am

Hi,

First off you can use
[ESPRESSO_STAFF id=”1″]
[ESPRESSO_STAFF id=”2″]
[ESPRESSO_STAFF id=”3″]
etc

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.

Viewing 10 reply threads

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.

Event Espresso