I’m trying to list events (custom posttype ‘kurs’) by event date, which are stored as custom fields (‘dato’).
My loop so far looks like this:
<ul>
<?php $loop = new WP_Query( array( 'post_type' => 'kurs' ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li><?php the_title( '<a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a>' ); ?></li>
<?php endwhile; ?>
</ul>
What I need is a list of post(event)-titles from today forward in the future…
You need to use the
meta_key
to sort your events in your array. Like so: