WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I did a custom post query for AIO Events Calendar, as described here: All in One Calendar Plugin Custom Post Type Query

But it doesnt work.

<?php echo esc_html( $event->cost ) ?>

returns the cost, but

<?php echo $contact ?>

and any other variable without $event-> returns nothing.

share|improve this question
up vote 1 down vote accepted

Anything that comes out of this query-- $event = Ai1ec_Events_Helper::get_event($post->ID);-- will need the $event-> part. That is how you access data from an object. That is just pure PHP.

I don't know why some of the values in that answer, like $contact, are not prefixed with $event-> but I am assuming those variables do not come from from that query.

Add var_dump($event); immediately after $event = Ai1ec_Events_Helper::get_event($post->ID); and you can see what information is in that object.

share|improve this answer
Thank you! You are right, the variables that I got from var_dump have different names than the variables without $event->. Thats why prefixing them didnt work. Now I have everything I need. – Sebastian Starke Feb 17 '13 at 19:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.