Date sorting in Verve Meta Boxes
-
Our site has an upcoming events box that pulls in post titles as the upcoming events with Location and Date/Time info pulled in via boxes created using Verve Meta Boxes. I couldn’t use the Date field type for the date info, as it doesn’t support date ranges but only single dates. So, we set up the Date/Time field as a text entry. Doing so makes the post date the date used for sorting the events instead of the event date. I’m wondering if I could set all post dates to the event dates, and have even the ones set in the future appear in the list?
Here’s the code:
<table id="ma_events"> <tr class="toprow"><td class="details">Details</td><td class="location">Location</td><td class="date_time">Date/Time</td></tr> <?php $temp = $event_query; // assign orginal query to temp variable for later use $event_query = null; $event_query = new WP_Query('cat=25,20&posts_per_page=5&orderby=date&order=asc'); if(have_posts()) : while($event_query->have_posts()) : $event_query->the_post(); ?> <tr class="eventrow"> <td><a>" rel="bookmark" title="Read more — <?php the_title_attribute(); ?>"><?php the_title(); ?></a></td> <td><?php echo get_post_meta($post->ID, 'location', true); ?></td> <td><?php echo get_post_meta($post->ID, 'date_time', true); ?></td> </tr> <?php endwhile; endif; $event_query = $temp; //reset back to original query ?> </table>
Thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Date sorting in Verve Meta Boxes’ is closed to new replies.