Title: Order Loop fields by Date
Last modified: August 31, 2016

---

# Order Loop fields by Date

 *  Resolved [914Digital](https://wordpress.org/support/users/soulstatic/)
 * (@soulstatic)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/order-loop-fields-by-date/)
 * Is there any way to do that?
 * Here’s my loop:
 *     ```
       $fields = CFS()->get('appearances');
   
                               foreach ($fields as $field) {
                            if ($field['date'] > date('Y-m-d', strtotime('today'))) { ?>
                              <?php echo '
       	                       <div class="row">
       	                      <div class="col-md-4"><img src="'.$field['image'].'" /></div>
       	                      <div class="col-md-8">
       	                        <p><strong>'.date('F j, Y', strtotime($field['date'])).'</strong></p>
       	                           <h2><a target="_blank" href="'.$field['event_website'].'">'.$field['event'].'</a></h2>
       	                               <h3>'.$field['subtitle'].'</h3>
       	                               <p>'.$field['event_details'].'</p>
       	                               <div class="event-meta-data">
       	                               <div class="row">
       	                      <div class="col-md-6">
       	                      <h4>Location:</h4>
       	                      <p><strong>'.$field['location'].'</strong><br />
       	                      '.$field['address'].'<br />
       	                      '.$field['city_and_state'].' '.$field['zip_code'].'
       	                       </p>
       	                      	                      </div>
       	                      <div class="col-md-6">
       	                      <h4>Time:</h4>
       	                      <p> '.$field['time'].'</p>
       	                      <h4>Event Site:</h4>
       	                      <p><a target="_blank" href=" '.$field['event_website'].'">Learn more>></a></p>
       	                      <h4>Cost:</h4>
       	                       <p> '.$field['cost'].'</p>
       	                      </div>
       	                     		 </div>
       	                     		 </div>
       	                     		 </div>
       	                               </div>
   
       	                               		<hr />
       	                               ' ?>
       	                                <?php   }  ?>
       	                                <?php   }  ?>
       ```
   
 * [https://wordpress.org/plugins/custom-field-suite/](https://wordpress.org/plugins/custom-field-suite/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Matt Gibbs](https://wordpress.org/support/users/mgibbs189/)
 * (@mgibbs189)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/order-loop-fields-by-date/#post-7174128)
 * A loop field contains an array of arrays.
 * It’s up to you to manipulate the data as needed. We unfortunately don’t have 
   to resources to provide specific guidance or examples. Find a developer to help
   if needed.

Viewing 1 replies (of 1 total)

The topic ‘Order Loop fields by Date’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-field-suite.svg)
 * [Custom Field Suite](https://wordpress.org/plugins/custom-field-suite/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-field-suite/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-field-suite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-field-suite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-field-suite/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Matt Gibbs](https://wordpress.org/support/users/mgibbs189/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/order-loop-fields-by-date/#post-7174128)
 * Status: resolved