0

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.

1 Answer 1

1

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.

1
  • 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. Feb 17, 2013 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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