Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
$20
Ordering by custom date (meta) field not working?
Can anyone see why?
Here is my query (and loop):
<?php
$today = date('U');
$args = array(
'post_type' => 'prosjekter',
'posts_per_page' => -1,
'meta_query' => array(
'key' => 'ecpt_konsertdato2',
'value' => $today,
'compare' => '>'
),
'orderby' => 'meta_value_num',
'meta_key' => 'ecpt_konsertdato2',
'type' => 'NUMERIC',
'order' => 'ASC'
);?>
Samlesider der du finner all info for hvert enkelt prosjekt
<hr/>
<?php
$today = date('U');
$args = array(
'post_type' => 'prosjekter',
'order' => 'ASC',
'meta_query' => array(
array(
'posts_per_page' => -1,
'key' => 'ecpt_konsertdato2',
'value' => $today,
'orderby' => 'meta_value',
'compare' => '>',
'order' => 'ASC'
)
)
);
query_posts($args);
if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div class="internliste">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?> (<?php $custom = get_post_custom($post->ID);
$date = $custom["ecpt_konsertdato2"][0];
echo date('d/m/Y', $date); ?>)</a>
</div>
<?php endwhile; wp_reset_query(); ?>
This question has been answered.
Torstein Opperud | 01/30/13 at 5:17pm
Edit
Tutorial: How to assign prize money
(3) Responses
See a threaded view of answers?
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
-

Last edited:
01/30/13
8:44pmDbranes says:Hej Torstein, what about this one:
<?php wp_reset_query(); ?>
<?php
$today = date('U');
$args = array(
'post_type' => 'prosjekter',
'posts_per_page' => -1,
'meta_key' => 'ecpt_konsertdato2',
'orderby' => 'meta_value_num',
'order' => 'ASC'
'meta_query' => array(
array(
'key' => 'ecpt_konsertdato2',
'value' => $today,
'type' => 'NUMERIC',
'compare' => '>',
)
)
);
$myquery = new WP_Query( $args );
while ( $myquery->have_posts() ) : $myquery->the_post(); ?>
<div class="internliste">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?> (
<?php $custom = get_post_custom(get_the_ID());
$date = $custom["ecpt_konsertdato2"][0];
echo date('d/m/Y', $date); ?>
)</a>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
Previous versions of this answer: 01/30/13 at 8:38pm | 01/30/13 at 8:44pm
-

Last edited:
01/30/13
9:22pmTorstein Opperud says:Hehe, actually I saw it myself just after posting it here, I guess thats what you get for working triple hours for the last week. Double query. Jeez...
-

Last edited:
01/30/13
9:24pm
This question has expired.
Gabriel Reguly, Torstein Opperud, Christianto, Arnav Joy, Naveen Chand voted on this question.
Current status of this question: Completed
Please log in to add additional discourse to this page.
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
