Support » Fixing WordPress » Help with Single Archive and Multiple Views (orderby)

  • Hi all,

    I am really stuck on this one.

    I understand how to sort an archive page (or category, or search) by different criteria… such as by title.

    However, what I need to be able to do is have multiple views, or instances, of the same archive page all with different orders.

    So, for example. The default is orderby date. I want to keep that. But I then want the user to be able to go to another page and see the SAME archives ordered by title. And then maybe go to yet another page, and see the SAME archives but this time ordered by a custom field.

    In my head, this would require 3 archive pages with 3 different loops. How do I do this though given the way wordpress handles template hierarchies? Each archive, or category, has but 1 archive page that wordpress grabs and uses.

    Thanks in advance for any help

Viewing 1 replies (of 1 total)
  • You can do this through one page, if all your changing is the column you’re ordering by and its direction. For the links pointing to these different requests, append these parameters into the url, such that :


    will order the posts by title in descending order. In your archive page, handle these parameters using the $_GET[] global variable and inject these into a custom wordpress query.

    Add some default values in case the parameters aren’t defined and you’re done 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘Help with Single Archive and Multiple Views (orderby)’ is closed to new replies.