Forums

Way to re-sort posts using in-page re-sorting links? (4 posts)

  1. invisiblelimb
    Member
    Posted 2 years ago #

    Hello. I am wondering if it is possible to re-sort the post order of a category archive page using in-page links (i.e. "Re-sort posts by Title" link, "Re-sort posts by Date" link, etc.).

    Thanks!

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    In the proper archive template, add this before the loop:

    query_posts($query_string . '&orderby=title&order=ASC')

    Related:
    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy

  3. invisiblelimb
    Member
    Posted 2 years ago #

    My question is: is there a way for a visitor to manually re-order posts using a set of links on the sidebar? Like this:

    Order posts by Name
    Order posts by Date

    And when a visitor clicks on either one, it re-sorts the page according to that order?

    Thanks.

  4. MichaelH
    Volunteer
    Posted 2 years ago #

    Could provide these as links (Note 1st example shows WordPress installed in a sub-folder of web-root:

    http://yourdomain.com/wordpress/?orderby=title&order=ASC
    http://yourdomain.com/?orderby=date&order=DESC

Topic Closed

This topic has been closed to new replies.

About this Topic