WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Articles on site not displaying in proper / default order (1 post)

  1. Mauri
    Member
    Posted 2 years ago #

    Hi,

    I am new to WordPress.

    Does anyone know what might cause posts not to display in the default reverse-chronological order?

    For example, on the dashboard, the articles are displayed in proper order:

    Article A
    Published: July 1

    Article B
    Published: June 1

    Article C
    Published: May 1

    But on the site, they display as follows:

    Article B
    Published: June 1

    Article C
    Published: May 1

    Article A
    Published: July 1

    I am using the following code for the loop:

    <div id="articles-container">
    
    <?php
    $article_args = array( 'category__and' => array( 65, 3 ),'posts_per_page' => 50, 'post_type' => 'post');
    $article_query = new WP_Query( $article_args );
    if (have_posts()):
    while ( $article_query->have_posts() ) : $article_query->the_post();
    $permalink = get_permalink();
    ?>
    <article class="single-article">
    <h3><a href="<?php echo $permalink; ?>"><?php the_title(); ?></a></h3>
    <div id="article-date"><?php the_date('M j, Y', '<p>', '</p>'); ?></div>
    <?php the_excerpt(); ?>
    </article>
    <?php endwhile; else: ?>
    <h4>There are currently no articles that fall under this category.</h4>
    <?php endif;
    wp_reset_postdata();
    ?>
    
    </div>

    I have tried deactivating some plugins that I thought might be causing a problem. Didn't make a difference.

    Thank you for any help you can provide.

Topic Closed

This topic has been closed to new replies.

About this Topic