Forum Replies Created
-
AuthorPosts
-
Kari AckerParticipant
Thanks for looking into this for me. Here is the code i ended up with and with this code nothing get pulled in at all. Do you think this is something wrong with how I integrated your code in with mine?
<div class="small-12 medium-6 large-4 columns"> <?php $args = array( 'eventDisplay' => 'custom', 'posts_per_page' => 1, 'meta_query' => array( 'relation' => 'AND', 'featured' => array( 'key' => Tribe__Events__Featured_Events::FEATURED_EVENT_KEY, 'compare' => 'EXISTS', ), 'start_date' => array( 'key' => '_EventStartDate', 'value' => current_time( 'mysql' ), 'compare' => '>=', 'type' => 'DATETIME', ), ), 'orderby' => array( 'start_date' => 'ASC', ), ); foreach ( $events as $event ) { $terms = get_the_terms( $event->ID, 'tribe_events_cat' ); ?> <p class="home-cat"><?php foreach ( $terms as $term ) { echo $term->name; } ?></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" data-equalizer-watch> <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 } ?> </div>
Kari AckerParticipantHi,
Im looking for the next upcoming featured event (based on start date).
Thanks
-DanKari AckerParticipantHi, So this is what i ended up with and its still just pulling in the latest 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' , 'key' => Tribe__Events__Featured_Events::FEATURED_EVENT_KEY , 'compare' => 'EXISTS' ) ); foreach ( $events as $event ) { $terms = get_the_terms( $event->ID, 'tribe_events_cat' ); ?> <p class="home-cat"><?php foreach ( $terms as $term ) { echo $term->name; } ?></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" data-equalizer-watch> <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 } ?> </div>
Kari AckerParticipantHi,
Im sorry but im still having issues getting this to work. Here is my code.
<div class="small-12 medium-6 large-4 columns"> <?php $events = tribe_get_events( array( 'posts_per_page' => 1, 'orderby' => 'meta_value', 'order' => 'DESC' , 'key' => 'Tribe__Events__Featured_Events::FEATURED_EVENT_KEY' , 'compare' => 'EXISTS', ) ); foreach ( $events as $event ) { $terms = get_the_terms( $event->ID, 'tribe_events_cat' ); ?> <p class="home-cat"><?php foreach ( $terms as $term ) { echo $term->name; } ?></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" data-equalizer-watch> <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>
Please let me know what I can do to get this working.
Thanks
-DanKari AckerParticipantHi,
So your highlighted part is talking about just the featured image. I already have that pulling in. Im just trying to get the “featured event” to pull in.
Thanks
-DanKari AckerParticipantIm still a little confused. I have the image pulling in already. Would I have to use this part in my query?`
`
// is a Featured Event (requires The Events Calendar version 4.4+ from January 9, 2017)
if ( class_exists( ‘Tribe__Events__Main’ )
&& class_exists( ‘Tribe__Events__Featured_Events’ )
&& Tribe__Events__Main::POSTTYPE === $query[‘post_type’]
) {
$meta_query[] = array(
‘key’ => Tribe__Events__Featured_Events::FEATURED_EVENT_KEY,
‘compare’ => ‘EXISTS’,
);
}
`Kari AckerParticipantHi,
So im still a little confused. Im still somewhat new with PHP and that seems like a really complex query just to pull in the featured event.
There is no way just to add it to my $events array to pull it in? I would rather not pull this in with a shortcode from my function. I would just like to have everything right in my original query.
Kari AckerParticipantThis worked perfect,
Thanks for the help.
Kari AckerParticipantThis is exactly what I was looking for.
Thank You.
-
AuthorPosts