Advertisement
nefi_c

event calendar custom loop

Jan 12th, 2013
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.53 KB | None | 0 0
  1.     global $post;
  2.    
  3.     $current_date = date('j M Y');
  4.     /* get upcoming 30 day event, you can edit this to less day */
  5.     $end_date = date('j M Y', strtotime('30 days'));
  6.  
  7.     $terms = get_terms( 'tribe_events_cat', 'hide_empty=0' );
  8.  
  9.     foreach($terms as $tribe_category){
  10.  
  11.     echo '<div class="event-wrapper">';
  12.  
  13.             /* Featured Event */
  14.             $all_events_one = tribe_get_events(
  15.                 array(
  16.                     'start_date'    => $current_date,
  17.                     'end_date'      => $end_date,
  18.                     'eventDisplay'  => 'upcoming',
  19.                     'posts_per_page'=> 1,
  20.                     'tax_query'=> array(
  21.                         array(
  22.                             'taxonomy' => 'tribe_events_cat',
  23.                             'field' => 'slug',
  24.                             'terms' => $tribe_category
  25.                         )
  26.                     )
  27.                 )
  28.             );
  29.            
  30.             /* Sub Event */
  31.             $all_events_two = tribe_get_events(
  32.                 array(
  33.                     'start_date'    => $current_date,
  34.                     'end_date'      => $end_date,
  35.                     'eventDisplay'  => 'upcoming',
  36.                     'posts_per_page'=> 3,
  37.                     'offset'        => 1,
  38.                     'tax_query'=> array(
  39.                         array(
  40.                             'taxonomy' => 'tribe_events_cat',
  41.                             'field' => 'slug',
  42.                             'terms' => $tribe_category
  43.                         )
  44.                     )
  45.                 )
  46.             );
  47.  
  48.             foreach($all_events_one as $featured) {
  49.                 setup_postdata($featured);
  50.             ?>
  51.             <div class="featured">
  52.  
  53.                 <h3><?php the_title(); ?></h3>
  54.                 <span class="event-date"><a href="<?php the_permalink(); ?>"><?php echo tribe_get_start_date($post->ID, true, 'M j, Y'); ?></a></span>
  55.  
  56.                 <?php if ( has_post_thumbnail() ) { ?>
  57.  
  58.                     <div class="event-thumb">
  59.                         <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a>
  60.                     </div>
  61.                     <div class="event-excerpt">
  62.                         <?php the_excerpt(); ?>
  63.                     </div>
  64.  
  65.                 <?php } else { ?>
  66.  
  67.                     <div class="event-content">
  68.                         <?php the_content(); ?>
  69.                     </div>
  70.  
  71.                 <?php } ?>
  72.  
  73.             </div>
  74.  
  75.             <?php } //endforeach
  76.                     wp_reset_query(); ?>
  77.            
  78.             <!-- start sub-event -->
  79.             <div class="ca-wrapper">
  80.            
  81.             <?php
  82.             foreach($all_events_two as $sub_event) {
  83.                 setup_postdata($sub_event);
  84.             ?>
  85.             <div class="ca-item ca-item-1">
  86.                 <div class="ca-item-main">
  87.                     <div class="ca-icon"></div>
  88.                     <h3><?php the_title(); ?></h3>
  89.                     <h4>
  90.                         <span class="ca-quote">&ldquo;</span>
  91.                         <span><?php the_excerpt(); ?></span>
  92.                     </h4>
  93.                         <a href="#" class="ca-more">more...</a>
  94.                 </div>
  95.                 <div class="ca-content-wrapper">
  96.                     <div class="ca-content">
  97.                         <?php the_content(); ?>
  98.                     </div>
  99.                 </div>
  100.             </div>
  101.             <?php } // end foreach
  102.                     wp_reset_query(); ?>
  103.            
  104.             <!-- end sub-event -->
  105.             </div>
  106.         <?php
  107.        
  108.     echo '</div>';
  109.    
  110.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement