Home › Forums › Calendar Products › Events Calendar PRO › Venue Post Type for WP Query
- This topic has 3 replies, 2 voices, and was last updated 7 years, 11 months ago by
ugapresents.
-
AuthorPosts
-
May 8, 2018 at 1:24 pm #1525694
ugapresents
ParticipantHi!
I have successfully created WP Queries using the code below and it pulls in the event post type.
<?php
$args = array(
‘post_type’ => array(TribeEvents::POSTTYPE)
)
?>Is there an equivalent that could pull in the venue post type? I am trying to create a page that lists the venues, but I want to include each venue’s image, title, address and a few other fields.
Thank you for the help!
May 9, 2018 at 11:58 am #1526488Jaime Marchwinski
KeymasterHi Blake,
Thanks so much for reaching out!
The post type for venues is tribe_venue.
You may also be interested in this article on crafting custom event queries:
https://theeventscalendar.com/knowledgebase/custom-event-queries/
Let me know if you have any other questions on this topic!
Thanks,
Jaime
May 10, 2018 at 12:12 pm #1527653ugapresents
ParticipantThank you Jaime! This got me started in the right track.
I’ll share my code if it’s helpful for anyone…<?php global $post; $events = tribe_get_events( array( 'posts_per_page' => -1, 'post_type' => tribe_venue, ) ); foreach ( $events as $post ) { setup_postdata( $post ); ?> <div class="col-md-6 individual-venue"> <a href="<?php echo get_permalink( $post ); ?>"> <div class="venue-thumbnail" style="background-image:url('<?php the_post_thumbnail_url('twentyseventeen-featured-image');?>')"></div></a> <h2><a href="<?php echo get_permalink( $post ); ?>"><?php echo $post->post_title ;?></a></h2> <hr class="red"/> <div class="venue-info"> <span id="address"> <?php echo tribe_get_full_address(); ?></span> <span id="phone"><?php echo tribe_get_phone(); ?></span> <span id="url"><?php echo tribe_get_venue_website_link( get_the_ID(), 'visit website', true ); ?></span> </div> <a class="btn-outline" href="<?php echo get_permalink( $post ); ?>">Learn More</a> </div> <?php } ?>May 11, 2018 at 4:10 am #1528038Jaime Marchwinski
KeymasterGlad we could help, and thanks for sharing!
You are welcome back in our support forums any time!
Since you marked this thread as Resolved, I am going to close this thread.
Have a great week!
-
AuthorPosts
- The topic ‘Venue Post Type for WP Query’ is closed to new replies.
