Support

Home Forums Event Espresso Premium Code to display price & description?

Code to display price & description?

Posted: July 22, 2015 at 9:21 am

Viewing 8 reply threads


Judy

July 22, 2015 at 9:21 am

See screenshot
http://www.brandinhall.com/1.jpg

Hello, I am using EE3 and customizing the “events-table” addon.
I am trying to display the price in my list as you can see in the screenshot. Everything is appearing as $0.. however, all of these events have a cost set to them.

The code I am using to try and display the price is:
<?php echo do_shortcode(‘[EVENT_PRICE event_id=”‘.$event_id.'” number=”0″]’);?>

Can you tell me what code will correctly display the events price?

Also, How can I display each event description?

Thanks!


Tony

  • Support Staff

July 22, 2015 at 2:21 pm

Hi Judy,

Within the events-table template this:

echo $event->event_cost;

Should output the price for the event.

Looking at the example you’ve posted above the reason it isn’t working is due to using $event_id, that variable isn’t setup within the template (unless you have done so yourself), you’ll want to use something like:

<?php echo do_shortcode('[EVENT_PRICE event_id="'.$event->id.'" number=0]');?>


Judy

July 22, 2015 at 2:34 pm

Perfect, that worked wonderfully, any chance there is a similar way to output the event description?

Many thanks!


Tony

  • Support Staff

July 22, 2015 at 2:41 pm

If you use:

var_dump($event);

Within that template you can see all the values set within $event, for description you use $event->event_desc

I would recommend using the espresso_format_content() function to format the output correct, like so:

<?php echo espresso_format_content($event->event_desc); ?>


Judy

July 22, 2015 at 3:06 pm

Thanks again, worked like a charm!
Mabye I can ask one more thing and my day will get even better because of you!

I am using the Staff Manager with EE3, I would like to output the staff I have created and assigned to each event on the template shown above, I attempted to use this code:

<?php echo do_shortcode(‘[ESPRESSO_STAFF event_id=”‘ . $event_id . ‘”]’); ?>

However nothing is showing, I am not very good with php so I am just trying to work with examples to pull this off. Is there something I need to define within my template again to make that shortcode work??

Also, will the staff that is displayed link to that persons page (if any?)

Thanks again, you’ve been a huge help!


Tony

  • Support Staff

July 22, 2015 at 3:45 pm

That’s likely the same issue as the first example.

$event_id is a variable that hasn’t been set within the template.

Change that from $event_id to $event->id

Also, will the staff that is displayed link to that persons page (if any?)

No, that shortcode will output a list of details set within the staff manager for the member you have assigned to the event.

  • This reply was modified 9 years, 4 months ago by Tony. Reason: typo


Judy

July 30, 2015 at 10:33 am

is there any code to only display the staff persons name and exclude all other information?


Judy

July 30, 2015 at 10:37 am

sorry, figured this out using short code parameters.


Tony

  • Support Staff

July 30, 2015 at 12:44 pm

I’m glad you got it figured out 🙂

There is a list of all of the available shortcodes and variables available within EE3 here:

https://eventespresso.com/wiki/shortcodes-template-variables/

Viewing 8 reply threads

The support post ‘Code to display price & description?’ 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