I'm making a custom activity calendar for a client here: http://arbeidshesten.com/aktivitetskalender/
The backend is a custom post type "aktiviteter", with custom fields for the date ("dato") and some more details.
The code looks like this:
<table>
<tr>
<th>Aktivitet</th>
<th>Sted</th>
<th>Dato</th>
<th>kontaktperson</th>
</tr>
<?php $loop = new WP_Query( array(
'post_type' => 'aktiviteter',
'meta_key' => 'dato',
'meta_value' => date('Y-m-d'),
'meta_compare' => '>=',
'orderby' => 'meta_value',
'order' => 'ASC'
) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php $display_date = date('d.m.Y', strtotime(get_post_meta($post->ID, "dato", true))); ?>
<tr>
<td><?php the_title( '<a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a>' ); ?></td>
<td><?php echo get_post_meta($post->ID, "sted", true); ?></td>
<td><?php echo $display_date; ?></td>
<td><?php echo get_post_meta($post->ID, "kontaktperson", true); ?></td>
</tr>
<?php endwhile; ?>
</table>
Funny thing is that the query returns just 2 aktivities, even though I entered (and published) about 5 future activities.
Anyone a clue?