Using Event CPT in Loop

Home Forums Calendar Products Events Calendar PRO Using Event CPT in Loop

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #26499
    Kyle
    Participant

    I am trying to make my first custom loop for events (I want to build a table from scratch) but am having some basic problems with getting a result out of the gate. It is a pretty basic query that is just looking for events by post type, but I am not getting anything

    global $post;
    $getid = $posts[0]->post_author;
    $q = new WP_Query( array( ‘author’ => $getid, ‘post_type’ => ‘TribeEvents::POSTTYPE’ ) );
    while ( $q->have_posts() ): $q->the_post( );
    the_title();
    endwhile; wp_reset_postdata();

    #26503
    Jonah
    Participant

    Hi Kyle,

    It likely has something to do with the author argument. Is $getid populated with anything? Try echoing it to see if it has anything or taking out the author argument in the query altogether. If it works without that, then you know it’s a problem with that part. Also, for post_type try ‘post_type’=>array(TribeEvents::POSTTYPE) instead.

    I hope that helps!

    – Jonah

    #26505
    Kyle
    Participant

    Thanks for the reply! I will try that out

    #26589
    Leah
    Member

    Sounds good Kyle! Let us know how it works out.

    #26732
    Michael
    Member

    Thanks, I had a similar issue and
    ‘post_type’=>array(TribeEvents::POSTTYPE)
    worked great!

    #26763
    Leah
    Member

    Awesome Michael! I’m glad you were able to find the answer here.

    #978004
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Using Event CPT in Loop’ is closed to new replies.