Home › Forums › Calendar Products › Events Calendar PRO › Trying to pull in the Events Calendar Pro Cat Name
- This topic has 4 replies, 2 voices, and was last updated 6 years, 10 months ago by Kari Acker.
-
AuthorPosts
-
May 22, 2017 at 2:03 pm #1287314Kari AckerParticipant
HI, Im running a simple query to show the latest event from the events cal pro plugin. Right now I have it pulling in the link, title and featured image.
I can not for the life of me figure out how to have it pull in its custom taxonomy associated with that event.
<div class="small-12 medium-6 large-4 columns"> <?php $events = tribe_get_events( array('posts_per_page' => 1, 'orderby' => 'meta_value', 'order' => 'DESC') ); foreach ( $events as $event ) { ?> <p class="home-cat"><?php echo tribe_get_event_cat_slugs( $post_id ) ?></p> <a href="<?php echo tribe_get_event_link( $event->ID ) ?>"><?php echo tribe_event_featured_image( $event->ID, 'home-blog', true ); ?></a> <div class="home-news-content clearfix"> <a href="<?php echo tribe_get_event_link( $event->ID ) ?>"><h2><?php echo $event->post_title; ?></h2></a> <p><?php echo $event->post_excerpt; ?></p> <a class="home-read-more" href="<?php echo tribe_get_event_link( $event->ID ) ?>">Read More</a> </div> <?php wp_reset_postdata(); } ?> </div>
May 22, 2017 at 8:00 pm #1287449TrishaMemberHello, Kari!
Thank you for using The Events Calendar! I can help with this ?
The easiest way to get the custom taxonomy for an event is to use the WordPress function ‘get_the_terms()’. I added it to your code to test, you can see the results in this gist.
https://gist.github.com/trishasalas/4b1e2c5084b56c994843672d3a938ce1
Does this help answer your question? Let me know how it goes!
Cheers,
TrishaMay 23, 2017 at 6:35 am #1287602Kari AckerParticipantThis worked perfect,
Thanks for the help.
May 23, 2017 at 10:33 pm #1288153TrishaMemberHi, Kari!
So glad to hear it! 🙂
I’m going to close this conversation out, but as always, if you need anything else feel free to reach out! I’m happy to help 🙂
Cheers,
Trisha -
AuthorPosts
- The topic ‘Trying to pull in the Events Calendar Pro Cat Name’ is closed to new replies.