Nowton

Event loop for frontpage

Dec 10th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.13 KB | None | 0 0
  1. <?php
  2.             global $post;
  3.             $all_events = tribe_get_events( array(
  4.                 'posts_per_page'=>3
  5.             )   );
  6.    
  7.         foreach($all_events as $post) {
  8.             setup_postdata($post);
  9.         ?>
  10.    
  11.             <?php
  12.             $image_id = get_post_thumbnail_id();  
  13.             $image_url = wp_get_attachment_image_src($image_id,'large');  
  14.             $image_url = $image_url[0];
  15.             ?>
  16.                         <article class="threecol" style="background: silver url('<?php echo $image_url ?>') center center no-repeat; background-size: cover">
  17.                
  18.                 <div class="meta">
  19.                                         <!--what-->  
  20.                                         <? tribe_meta_event_cats($args); ?>
  21.                                         <? //echo tribe_get_event_categories(); ?>
  22.                                    <span class="when">
  23.                                    <?php echo tribe_get_start_date($post->ID, false, 'j F Y H:i'); ?>
  24.                                      </span>    
  25.                                      <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
  26.                
  27.                   </div>
  28.  
  29.             </article>
  30.    
  31.         <?php } //endforeach ?>
  32.         <?php wp_reset_query(); ?>
Advertisement
Add Comment
Please, Sign In to add comment