Advertisement
Guest User

Untitled

a guest
Nov 12th, 2011
1,779
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.82 KB | None | 0 0
  1. <?php
  2. global $ai1ec_calendar_helper, $ai1ec_events_helper;
  3.  
  4. $bits = $ai1ec_events_helper->gmgetdate( $ai1ec_events_helper->gmt_to_local( time() ) );
  5. $start_time = gmmktime( 0, 0, 0, 1, 1, 1970 );
  6. $end_time = gmmktime( 0, 0, 0, 1, 1, 2100 );
  7.  
  8. // retrieve events that start today and end today, ordered by start time, all day events are displayed first
  9. $events = $ai1ec_calendar_helper->get_events_relative_to( $start_time, $end_time, 'publish', array(), array() );
  10. $post_ids = array();
  11. foreach( $events as $event ) :
  12.   $post_ids[] = $event->post_id;
  13. endforeach;
  14. ?>
  15.  
  16. <h1 class="section-title">New Events</h1>
  17. <div id="events_added" class="events_list">
  18.     <?php
  19.        
  20.     // The New Events Query
  21.     $args = array(
  22.         'posts_per_page'  => 4,
  23.         'paged'                => get_query_var('paged'),
  24.                 'post__in'             => $post_ids
  25.         );
  26.                
  27.     $events_added = new WP_Query( $args );
  28.     // The Loop
  29.     while ( $events_added->have_posts() ) : $events_added->the_post();
  30.                
  31.     $event = Ai1ec_Events_Helper::get_event($post->ID);
  32.                    
  33.     ?>
  34.         <div class="single_post">
  35.                
  36.             <div class="text_container">
  37.                 <a class="single-title" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
  38.                 <h2><?php the_title(); ?></h2>
  39.                 </a>
  40.                 <span>
  41.                     <ul>
  42.             <li class="home_when"><?php echo $event->long_start_date;?> -</li>
  43.             <li><?php echo $event->short_end_date;?></li>
  44.             <li class="home_where"><?php echo $event->venue; ?></li>
  45.             <li><?php echo $event->city; ?>, <?php echo $event->country; ?></li>
  46.                     </ul>
  47.                 </span>
  48.             </div>
  49.             <span class="read_more">
  50.             <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
  51.                 Find out more...
  52.             </a>
  53.             </span>
  54.         </div>         
  55.         <?php
  56.            
  57.         endwhile;
  58.                
  59.         // Reset Post Data
  60.         wp_reset_postdata();
  61.         ?>
  62. </div><!-- #events_added -->
  63.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement