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.


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.

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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