Guest User

Tribe Events wp_query - Trial 2

a guest
Nov 12th, 2014
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 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_query' => array(
  8.                 'relation' => 'AND',
  9.                     array(
  10.                         'key'     => 'col1_destacado_3',
  11.                         'value'   => true,
  12.                         'compare' => '=',
  13.                     ),
  14.                     array(
  15.                         'key' => '_EventStartDate',
  16.                         'value' => date('Y-m-d') . ' 00:00:00',
  17.                         'compare' => '>='
  18.                     ),
  19.                 ),                    
  20.                 'orderby'    => '_EventStartDate',
  21.                 'order'      => 'ASC',
  22.                                 'posts_per_page' => 3)
  23.                 );
  24.    
  25.     if ($upcoming->have_posts()) :
  26.         while ($upcoming->have_posts()) :
  27.             $upcoming->the_post();
  28.             ?>
  29.             <li>
  30.               <?php if ( has_post_thumbnail() ) { ?>    
  31.                  <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail();?></a>
  32.               <?php }?>                
  33.               <div class="content">
  34.                   <span class="event-meta"><strong>DATE</strong>: <?php echo esc_html( tribe_get_start_date()); ?></span>
  35.                   <a href="<?php the_permalink() ?>"><?php the_title(); ?></a>                                
  36.               </div>        
  37.             </li>
  38.         <?php
  39.         endwhile;
  40.     endif;
  41.     wp_reset_query(); // reset the query ?>
  42. </ul>
Advertisement
Add Comment
Please, Sign In to add comment