Sort Loop by Date
-
Hey Guys: Great plugin. I was wondering how to order posts within a loop by date? I figured out how to make them expire. I just wasn’t sure where to put the “orderby=ASC” Here’s what I currently have as my code:
$fields = $cfs->get('appearances'); foreach ($fields as $field) { if ($field['date'] > date('Y-m-d H:i:s')) { echo '<div class="custom-fields"><div class="field-thumbnail"><img src="',$field['image'],'" ></div><div class="appearancesright">'; echo '<div class="custom">',date('F j, Y', strtotime($field['date'])),'</div>'; echo '<h4>',$field['event'],'</h4>'; echo '<div class="custom">',$field['time'],'</div>'; echo '<div class="custom">',$field['location'],'</div>'; echo '<div class="custom">',$field['address'],'</div>'; echo '<div class="custom">',$field['city_and_state'],'</div>'; echo '<div class="custom">',$field['event_details'],'</div>'; echo '<div class="custom"><a href="',$field['event_website'],'">Event Page</a></div></div>'; echo '<div class="clear"></div></div>'; } } } ?>[Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Sort Loop by Date’ is closed to new replies.