I developed a site for a client using a premade theme called “Adapt“. When I was developing on my own server, the blog posts were posting as they should in descending order (i.e. new to old with new being on top). However, when I moved the completed work to my client’s server and imported his blog posts from his old site, the posts started displaying in ascending order (i.e. old to new with old being on top).

I’ve tried deactivating all plugins but the problem remains. I’ve also tried adding right before , but nothing changed.

The funny thing is that the blogs on the archive pages are behaving as they should. The posts are shown from new to old, with new being on top.

Below is the code for the index page where the blogs are behaving this way. Any help in getting this sorted out would be appreciated. Thank you.

<?php get_header(); ?>
    <?php if (dt_is_sidebar_active('homepage_ad')) : ?>
        <div id="homepage-ad" class="widget-area">
                <?php dynamic_sidebar('homepage_ad'); ?>
        </div><!-- #homepage-ad .widget-area -->
    <?php endif; ?>
    <!--BEGIN #content -->
    <div id="content">
        <div id="sidebar">
            <div id="home-sidebar" class="widget-area">
                    <?php get_sidebar(); ?>
            </div><!-- #home-sidebar .widget-area -->
        </div><!-- #sidebar -->
        <!--BEGIN #masonry -->  
        <div id="masonry">
            <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
            <!--BEGIN .item --> 
            <div class="item normal" data-order='1'>
                <!--BEGIN .hentry -->
                <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
                    <?php if ( has_post_thumbnail() ) : ?>
                    <!--BEGIN .featured-image -->
                    <div class="featured-image">
                        <div class="da-hover">
                            <span class="da-wrap">
                                <span class="title"><?php the_title(); ?></span>
                                <?php dt_overlay_icon(); ?>
                            </span>
                        </div>
                        <a href="<?php the_permalink(); ?>"><?php dt_image(300, ''); ?></a>
                    <!--END .featured-image -->
                    </div>
                    <?php endif; ?>
                    <span class="meta-category"><?php the_category(', '); ?></span>
                    <h2 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                    <!--BEGIN .post-content -->
                    <div class="post-content">
                        <?php $format = get_post_format(); ?>
                        <?php if ($format == "image" || $format == "gallery" || $format == "video") : ?>
                        <span class="icon"><img src="<?php echo get_template_directory_uri(); ?>/images/icon-<?php echo $format; ?>.png" alt="<?php echo $format; ?>" /></span>
                        <?php endif; ?>
                        <?php dt_excerpt(20); ?>
                    <!--END .post-content -->
                    </div>
                    <a class="read-more" href="<?php the_permalink(); ?>"><?php _e('Read More', 'engine'); ?></a>
                    <!--BEGIN .post-footer -->
                    <div class="post-footer">
                        <span class="meta-published"><?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' '.  __('ago', 'engine'); ?></span>
                        <span class="meta-comments"><?php comments_number(__('No Comments', 'engine'), __('1 Comment', 'engine'), __('% Comments', 'engine')); ?></span>
                    </div>
                    <!--END .post-footer -->
                <!--END .hentry-->  
                </div>
            <!--END .item -->   
            </div>
            <?php endwhile; endif; ?>
            <?php get_template_part('includes/index-loadmore'); ?>
        <!--END #masonry -->
        </div>
        <div id="masonry-new"></div>
        <!--BEGIN .post-navigation -->
        <div class="post-navigation clearfix">
            <?php dt_pagination(); ?>
        <!--END .post-navigation -->
        </div>
    </div><!-- #content -->
<?php get_footer(); ?>

Read more here: Blogs are being posted from old to new, in ascending order


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , ,

Wordpress related questions and answers: