Venue Post Type for WP Query

Home Forums Calendar Products Events Calendar PRO Venue Post Type for WP Query

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1525694
    ugapresents
    Participant

    Hi!
    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!

    #1526488

    Hi 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

    #1527653
    ugapresents
    Participant

    Thank 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
    	}
       ?>
    #1528038

    Glad 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!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Venue Post Type for WP Query’ is closed to new replies.