Hi, any help here would be amazing I’m going a bit mad!
I am trying to create custom post meta date fields that can display a start and end time for an event attached to a post. I do not want a custom post type, just simple meta boxes that then display this information on the front end if applicable.
My problem is on the front end:
When displaying the dates I need the start date to sort by newest first and the no dates that have passed (EG older than the current day) to display either.
I’ve been folowng this tutorial: http://wptheming.com/2011/11/event-posts-in-wordpress/
But is stops short of telling me how to get this query working as I described above using the last piece of code:
$args = array( ‘post_type’ => ‘event’,
‘meta_key’ => ‘_start_eventtimestamp’,
‘order’ => ‘ASC’,
‘posts_per_page’ => 20,
$events = new WP_Query( $args );
if ( $events->have_posts() ) :
while ( $events->have_posts() ) : $events->the_post();
echo ‘<li><a href=”‘ . get_permalink() . ‘”>’ . get_the_title() . ‘</a></li>’;
I am totally stuck!
- The topic ‘Post meta date sorting by event date and present day’ is closed to new replies.