Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I cannot order my query by meta value by numbers, and ordering by post order does not work too. This is my code:

<?php
$args = array(
      'posts_per_page' => '-1',
        'post_type' => 'post',
        'order'     => 'ASC',
        'meta_key' => 'nda_cf3',
        'orderby'   => 'meta_value_num', //or 'meta_value_num'

);

    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();
    echo '<li rel="'.get_post_meta($post->ID, 'nda_cf3', true).'"><strong><a href="'.get_permalink().'">'.get_the_title().'</a></strong>'.' <p>'.get_the_content().'</p></li>';

    endwhile;   
?>
share|improve this question
1  
Do you use any plugin(s) which modify query or post order? –  Max Yudin Sep 13 '13 at 10:16
    
Is nda_cf3 actually a number? Letters or punctuation will cause strange results. I don't know what you mean by "post order"-- "post ID" maybe? –  s_ha_dum Sep 13 '13 at 13:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.