Ok, thanks! I think I got it now ??
I ended up with this code:
<?php if(have_posts()) : ?>
<?php $loop = new WP_Query( array(
'posts_per_page' => 10,
'cat' => 15,
'meta_key' => 'Dato',
'orderby' => 'STR_TO_DATE(meta_value, \'%d/%m/%Y\')',
'order' => 'ASC') );
while ( $loop->have_posts() ) : $loop->the_post();
Also I added the following, to exclude expired posts:
$expirationtime = get_post_custom_values('expiration');
if (is_array($expirationtime)) {
$expirestring = implode($expirationtime);
}
$secondsbetween = strtotime($expirestring)-time();
if ( $secondsbetween > 0 ) {
I had to add another custom field called expiration
, populated with mm/dd/yyyy 00:00:00
, for this to work.
Again, thanks alot ??