Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-sales domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the better-click-to-tweet domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-amazon domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-stats domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Change shortcode to variable | Event Espresso - Staging Server

Support

Home Forums Event Espresso Premium Change shortcode to variable

Change shortcode to variable

Posted: February 10, 2014 at 1:39 pm

Viewing 6 reply threads


devjenifer

February 10, 2014 at 1:39 pm

Hi,
question from a non-programmer:
How do I use this shortcode in a template?
[EVENT_CUSTOM_VIEW template_name=”events-table” limit=”4″].


Anonymous

February 10, 2014 at 2:55 pm

Hi devjenifer,

Wrap that shortcode within the do_shortcode() function so within the Template it would become something like this:

do_shortcode('[EVENT_CUSTOM_VIEW template_name="events-table" limit="4"]');

Hope that helps.


devjenifer

February 10, 2014 at 4:00 pm

Thanks Tony, I tried your suggestion, but I do not get a list of the latest four events.

The shortcode worked on a static page, but I want to place the latest four events in a template. Could I use something like:
<?php echo $event_id…correct syntax to show 4 ?>


Dean

  • Support Staff

February 11, 2014 at 12:18 am

Hi,

If you are wanting to add the shortcode to a template then Tony’s code is correct. You do need to echo it out though liek so

<?php echo do_shortcode('[EVENT_CUSTOM_VIEW template_name="events-table" limit="4"]'); ?>

This can be added to theme templates such as single.php.


devjenifer

February 11, 2014 at 3:38 am

yep, worked perfectly, thanks Dean!


Anonymous

February 11, 2014 at 3:44 am

Sorry Jenifer,

Didn’t think to mention to echo!

Anyway, glad Dean spotted it and got you working :)


devjenifer

February 11, 2014 at 4:04 am

np, you guys rock!

Viewing 6 reply threads

The support post ‘Change shortcode to variable’ 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 - Staging Server