-
-
Save logoscreative/970d9a18c9bdf0931549 to your computer and use it in GitHub Desktop.
TEC Query Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'tribe_events_before_template', 'my_featured_events' ); | |
function my_featured_events() { | |
if ( !isset($_GET['tribe_region']) ) { | |
global $post; | |
$stickyargs = array( | |
'posts_per_page' => - 1, | |
'orderby' => 'menu_order', | |
'order' => 'ASC' | |
); | |
$stickyevents = tribe_get_events( $stickyargs ); | |
if ( $stickyevents ) { ?> | |
<div class="featured-tribe-event tribe-events-loop vcalendar"> | |
<h4>Featured Events</h4> | |
<?php | |
foreach ( $stickyevents as $post ) { ?> | |
<!-- Event --> | |
<?php if ( $post->menu_order !== - 1 ) { | |
break; | |
} | |
setup_postdata( $post ); | |
$post_parent = ''; | |
if ( $post->post_parent ) { | |
$post_parent = ' data-parent-post-id="' . absint( $post->post_parent ) . '"'; | |
} | |
?> | |
<div id="post-<?php the_ID() ?>" | |
class="<?php tribe_events_event_classes() ?>" <?php echo $post_parent; ?>> | |
<?php | |
tribe_get_template_part( 'list/single', 'event' ); ?> | |
<div class="tribe-clear"></div> | |
</div> | |
<!-- .hentry .vevent --> | |
<?php | |
} | |
wp_reset_postdata(); ?> | |
</div><!-- .tribe-events-loop --> | |
<?php | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment