• Resolved rondebbs

    (@rondebbs)


    Hello I created a static website earlier but this is my first blog (obama-amesty.org). Is there a simple way to reverse the post order so the first post displays first?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter rondebbs

    (@rondebbs)

    I should have noted that I am using the 2014 theme.

    lisa

    (@contentiskey)

    if you are comfortable making theme template changes, it is possible to change the order of display of posts. what is your comfort level with making changes? do you have a child theme set up so you don’t make changes directly to the original 2014 theme files?

    Thread Starter rondebbs

    (@rondebbs)

    Yes, I will make a child theme and make any needed changes if you can point me to the correct .php file and what should be changed. Also, I just switched to the 2012 theme for now as I bought a book that covers that theme. Thanks for your help.

    lisa

    (@contentiskey)

    after creating a child theme so you won’t be changing original theme files:

    for twentytwelve theme look in this template to find “the loop”:
    Main Index Template (index.php)
    it is labeled: Start the Loop

    read the full details from the codex for what areas to edit to change order of posts:
    http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters

    =====
    if something goes wrong with the changes you are trying to make , you can always remove the problem file from child theme via FTP client and start over with the change.

    Thread Starter rondebbs

    (@rondebbs)

    Ok, I have created the child theme and located the Loop in the original index.php. I guess I just add the $query statement below some where in the loop of my child theme. Can I put it as the first statement right after /* Start the Loop */?>

    $query = new WP_Query( array ( 'order' => 'DESC' ) );

    <?php /* Start the Loop */ ?>
    			<?php while ( have_posts() ) : the_post(); ?>
    				<?php get_template_part( 'content', get_post_format() ); ?>
    			<?php endwhile; ?>
    
    			<?php twentytwelve_content_nav( 'nav-below' ); ?>
    
    		<?php else : ?>
    
    			<article id="post-0" class="post no-results not-found">
    Thread Starter rondebbs

    (@rondebbs)

    I added the following line before the loop in index.php. Works good. I’m surprised WordPress does not have some simple way in the GUI to toggle between ASC and DESC.

    <?php get_header(); query_posts($query_string . “&order=ASC”); ?>

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Reverse post order’ is closed to new replies.