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.
<?php query_posts( 'cat=16'); ?>
        <?php if ( have_posts() ) 
        while ( have_posts() ) : the_post(); ?>     

                      <?php print_custom_field('time'); ?>
                       <?php the_title(); ?>

<?php endwhile;?>

this is my query I want the post is order by custom field 'time' in ASC

share|improve this question

1 Answer 1

That would be something like:

query_posts( array(
                  'cat' => '16',
                  'order' => 'ASC',
                  'orderby' => 'meta_value',
                  'meta_key' => 'time',
             ) );

See WP_Query documentation in Codex for more information.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.