Support

Home Forums Event Espresso Premium Dynamicly disply event price

Dynamicly disply event price

Posted: July 10, 2014 at 7:53 am

Viewing 3 reply threads


blue level

July 10, 2014 at 7:53 am

how can i grab an event price dynamicly i tried this but it dosent work

<code>
&lt;p id=&quot;p_event_price-&lt;?php echo $event_id = 17 ?&gt;&quot; class=&quot;event_price&quot;&gt;&lt;span class=&quot;section-title&quot;&gt;&lt;?php  echo __('Price: ', 'event_espresso'); ?&gt;&lt;/span&gt; &lt;?php echo  $org_options['currency_symbol'].$event-&gt;event_cost; ?&gt;&lt;/p&gt;
</code>


Tony

  • Support Staff

July 10, 2014 at 9:11 am

Hi Blue,

Turns out that code doesn’t show us much. Can you explain a little more please?

Where are you using this?
What exactly isn’t working correctly?


blue level

July 14, 2014 at 4:56 am

basicly i just need a bit of code that says get event id 17 price but without the vat


Josh

  • Support Staff

July 14, 2014 at 3:38 pm

Hi Blue Level,

Here is an example of a little function that gets the price for an event. You add this to your functions file:

function espresso_return_price_for_event ( $event_id ) {
	global $wpdb;
	return $wpdb->get_var($wpdb->prepare( "SELECT event_cost FROM " . EVENTS_PRICES_TABLE . " WHERE event_id = %d" , $event_id ));
}

Then you can add something like this where you want the price to be displayed:

<?php echo '$' . espresso_return_price_for_event( $event_id ); ?>

Viewing 3 reply threads

The support post ‘Dynamicly disply event price’ 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