• So basically what I am trying to do here is create a custom page that queries out list of events from The Events Calendar plugin, but in a very specific way. So instead of the usual list view they give you, it would look something like this:

    [Fri 4/1]
    Event Name 1 (Time)(Venue Name)
    Event Name 2 (Time)(Venue Name)

    [Sat 4/2]
    Event Name 1 (Time)(Venue Name)
    Event Name 2 (Time)(Venue Name)
    Event Name 3 (Time)(Venue Name)
    ….and so on….

    So I need to loop through the days, then each day needs a loop of the events within that day.

    I have a work in progress page located here: http://www.omahablues.com/events-calendar-list/

    Here’s the code I have so far:

    $args = array(
        'post_type' => 'tribe_events',
        'meta_key' => '_EventStartDate',
    	'orderby' => 'meta_value',
    	'order' => 'ASC',
        'posts_per_page' => '-1'
    );  
    
    $event_query = new WP_Query( $args );
    $prevdate = "";
    if ($event_query->have_posts()) :   
    
        while ($event_query->have_posts()) :
          $event_query->the_post();
    	  $event->EventStartDate = tribe_get_event_meta( $event->ID, '_EventStartDate', $format = 'M d' );
    	  $curDate = strtotime( $event->EventStartDate ); ?>
    	  <ul class="event-date">
          <?php  echo $curDate;
    	  echo tribe_get_start_date($post, false, $format = 'D M d') . "<br />"; ?>
          <?php //$date_rundown = tribe_get_start_date( $event, false, $format ); ?>
    	   <?php if ($curDate != $prevDate) :
           foreach ( $event as $curDate) { ?>
           <li class="event-line">
    
           <?php echo tribe_get_event_meta( $event->ID, '_EventStartDate', true );
    	   	 the_title ();
    		 echo  " (" . tribe_get_start_time( $event, false, $time_format ) . ") (" . tribe_get_venue($event_id) . ")";?></li>
    		<?php
    		//echo tribe_events_event_schedule_details( $event_id, '<h3>', '</h3>' );
    		//echo $date = strtotime( $event->EventStartDate );
    		$prevDate = $curDate;
    	   }
    		endif;
    		?>
    		</ul>
    		<!--<div class="event-desc">-->
    		<?php //the_excerpt(); ?>
    		<!--</div>-->
    
              <?php
        endwhile;  
    
    endif;  
    
    wp_reset_query(); // Remember to reset

    I realize that this question may be better of posted on The Events Calendar plugin forum, but in the case I want to do something like this again in the future with a custom post type I want know how.

    Thanks in advance

  • The topic ‘Trouble with a custom loop inside of a loop – events calendar’ is closed to new replies.