Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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. –  Lord_Mord Feb 17 '13 at 19:38

Your Answer

 
discard

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.