Guest User

Tribe Events wp_query - Trial 1

a guest
Nov 12th, 2014
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.15 KB | None | 0 0
  1. <ul class="block posts-list upcoming-events">
  2. <?php /* Featured upcoming events */
  3.                
  4.                 $upcoming = new WP_Query();
  5.                 $upcoming->query( array(
  6.                     'post_type'=> array('tribe_events'),
  7.                     'meta_key' => 'home_featured',
  8.                                   'meta_value'=> true,
  9.                                   'posts_per_page' => 3)
  10.                 );
  11.    
  12.     if ($upcoming->have_posts()) :
  13.         while ($upcoming->have_posts()) :
  14.             $upcoming->the_post();
  15.             ?>
  16.             <li>
  17.               <?php if ( has_post_thumbnail() ) { ?>    
  18.                  <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail();?></a>
  19.               <?php }?>                
  20.               <div class="content">
  21.           <span class="event-meta"><strong>DATE</strong>: <?php echo esc_html( tribe_get_start_date()); ?></span>
  22.                   <a href="<?php the_permalink() ?>"><?php the_title(); ?></a>                                
  23.               </div>        
  24.             </li>
  25.         <?php
  26.         endwhile;
  27.     endif;
  28.     wp_reset_query(); // reset the query ?>
  29. </ul>
Advertisement
Add Comment
Please, Sign In to add comment