[Resolved] Cant sort posts with custom query
Nothing will sort using any of the following code, I have tried many other options as well, but these are examples directly from WP, so they should be working… If I change numberposts, it works, but not sort by any option (title, id or ASC, DESC)…
I am using mostly the second code block below… Any thoughts or similar problems?
<?php $args = array( 'numberposts' => 3, 'order'=> 'ASC', 'orderby' => 'title' ); $postslist = get_posts( $args ); foreach ($postslist as $post) : setup_postdata($post); ?> <div> <?php the_date(); ?> <br /> <?php the_title(); ?> <?php the_excerpt(); ?> </div> <?php endforeach; ?>
$loop = new WP_Query('category_name=food-specials&orderby=id&order=DESC'); while ( $loop->have_posts() ) : $loop->the_post();
- The topic ‘[Resolved] Cant sort posts with custom query’ is closed to new replies.