Support

Home Forums Event Espresso Premium Variables using do_shortcode not working in single-event_espresso.php

Variables using do_shortcode not working in single-event_espresso.php

Posted: July 22, 2012 at 10:47 am


mcote

July 22, 2012 at 10:47 am

In the single-event_espresso.php file, the variables coded this way:

$event_start_date = get_post_meta($post->ID, 'event_start_date', true); work fine whereas the other variables using the do_shortcode do not work. $event_time = do_shortcode('[EVENT_TIME event_id="'.$event_id.'" type="start_time"]');

I have used other do_shortcode with my themes shortcodes in the template and they did work fine but the event espresso’s shortcodes do not bring back the values of the variables.

I verified in the database and I do have values. I am using the latest version 3.1.25.P

  • This topic was modified 11 years, 9 months ago by  Josh. Reason: moving to correct forum topic category


Seth Shoultes

  • Support Staff

July 22, 2012 at 11:11 am

Sounds like the $event_id variable is not being declared.


mcote

July 22, 2012 at 1:47 pm

Maybe this could be of any value, I also tried hardcoding the event_id value directly in the code and it didn’t bring back the information.


Josh

  • Support Staff

July 23, 2012 at 6:56 am

The following variable should be included with the group of variables declared just after the loop in single-espresso_event.php:

$event_id = get_post_meta($post->ID, 'event_id', true);


mcote

July 23, 2012 at 7:34 pm

The variable is included with this group of variables:

  $event_identifier = get_post_meta($post->ID, 'event_identifier', true);
  $event_id = get_post_meta($post->ID, 'event_id', true);
  $event_start_date = get_post_meta($post->ID, 'event_start_date', true);
  $event_end_date = get_post_meta($post->ID, 'event_end_date', true);
  $event_thumbnail_url = get_post_meta($post->ID, 'event_thumbnail_url', true);

within the single-event_espresso.php, file yet it doesn’t work.


Josh

  • Support Staff

July 24, 2012 at 8:44 am

Looks like it’s more of an issue with the event_time shortcode. I’ve created a ticket to address this. For now, try using the $event_start_date:

                <p class="start_date">
                    <span class="section-title">Date: </span>
                    <?php echo $event_start_date; ?>
                </p>


Noah Purves-Smith

August 2, 2012 at 2:13 pm

It seems like the shortcode for EVENT_PRICE and EE_META are also not working.


Josh

  • Support Staff

August 2, 2012 at 2:30 pm

Where are they not working?


Noah Purves-Smith

August 2, 2012 at 2:40 pm

They aren’t working in the single-espresso_event.php and page-event_list.php templates from the post-type-samples.


Josh

  • Support Staff

August 2, 2012 at 3:32 pm

For the price shortcode, open up includes/shortcodes.php and change line 283 from

espresso_return_single_price($event_id, $number);

to

echo espresso_return_single_price($event_id, $number);

For the ee_meta in the above mentioned templates, you’ll need to declare $event_meta:

<?php global $event_meta;
     $event_meta = event_espresso_get_event_meta($event_id); ?>


Noah Purves-Smith

August 2, 2012 at 3:42 pm

Thank you, Josh!

The support post ‘Variables using do_shortcode not working in single-event_espresso.php’ 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