Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Jasper Holtjer
Jasper Holtjer
3,370 Points

Reorder custom WordPress loop

Hi, I was looking for the same setup/effect as http://www.webdesignernews.com/. As people click on one of the categories (up top, like "design", "funny", etc.) and then choose how to order them by "most voted" or "most clicked". They stay in the same categorie, even when switching to another order.

I've managed to achieve the first part by setting up a simple category.php page and specific pages for each 'order by' filters with a custom page template (with a custom WordPress loop). But if I click at one of my 'order by' filters I switch back to the overall archive and don't stay in the same category as I'm already in.

Desired effect:

  1. I go to http://www.webdesignernews.com/ and choose "funny" (url is now: http://www.webdesignernews.com/category/funny).
  2. If I then click at "most voted" I will see the links of the category "funny" ordered by most votes. (url is now: http://www.webdesignernews.com/most-voted/category/funny).

If I take the two steps at my domain, I'll get the following urls:

  1. mydomain.com/category/horror-books (no issues so far).
  2. mydomain.com/most-pages (here is the problem; I'm not in my category "books" anymore).

Does anyone know what will be a better solution? Cause I don't think those page templates will do the trick. Thanks advance!

Best, Jasper