Skip to content

Instantly share code, notes, and snippets.

@logoscreative
Created September 23, 2015 23:30
Show Gist options
  • Save logoscreative/970d9a18c9bdf0931549 to your computer and use it in GitHub Desktop.
Save logoscreative/970d9a18c9bdf0931549 to your computer and use it in GitHub Desktop.
TEC Query Example
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