• Charliebee1990

    (@charliebee1990)


    Hi there,

    I am trying to order the posts by the date modified rathter than created. While researching i found a snippet of code that you add in the index file but when editing or even adding a new post they are duplicating. Now from more research i think this has something to do with looping but still unsure…

    Can someone please advise me where this code has gone wrong?

    Thanks.

    Code from index.php

    <?php get_header(); ?>
    <?php get_template_part( 'nav', 'above' ); ?>
    //The next line is what i have added in.
    <?php  global $query_string; query_posts( $query_string . '&orderby=modified' );?>
    <?php while ( have_posts() ) : the_post() ?>
    <?php get_template_part( 'entry' ); ?>
    <?php get_sidebar(); ?>
    <?php endwhile; ?>
    <?php get_template_part( 'nav', 'below' ); ?>
    <?php get_footer(); ?>

    [please remember to mark any posted code – http://codex.wordpress.org/Forum_Welcome#Posting_Code ]

  • The topic ‘Query string in index file duplicating posts’ is closed to new replies.