Forums

How to sort Tag Archive by date modified? (2 posts)

  1. chymera00
    Member
    Posted 2 years ago #

    I want to list posts in the "Tag Archive" by date modified instead of date posted.

    I tried to make a custom query in the tag.php file using "query_post" and add "sort=modified" but it messes with the pagination and shows up all posts instead of the proper tagged posts.

    I hope someone can help me.

    Thanks

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Using the WordPress Default theme, copied archive.php to tag.php, edited that file and before this line:

    <?php while (have_posts()) : the_post(); ?>

    added this:

    <?php query_posts($query_string . '&orderby=modified&order=DESC'); ?>

    and changed this line:

    <small><?php the_time('l, F jS, Y') ?></small>

    to this:

    <small><?php the_modified_time('l, F jS, Y') ?></small>

Topic Closed

This topic has been closed to new replies.

About this Topic