• I’m trying to get all posts in a certain category and display the titles in a certain order.

    Everything works but the ‘orderby’ bit. No matter what values I put there, nothing changes.

    Here’s my code. Help appreciated

    <?php global $post;
    $args = array( 'posts_per_page' => 1000, 'category' => 3, 'orderby' => 'date', 'order' => 'asc' );
    $myposts = get_posts( $args );
    foreach( $myposts as $post ):?>
    <div class="obitsidebaritem">
    <?php setup_postdata($post); ?>
    <a>">
    <?php echo get_the_post_thumbnail($post->ID, 'thumbnail');?>
    <p><?php the_title();?></p></a>
    </div>
    <?php endforeach; ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Order of posts query not working’ is closed to new replies.