819 posts
  • Power Elite Author: Sold between 1 000 000 - 1 999 999 dollars
  • Power Elite Author
  • Won a Competition
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Europe
  • Bought between 10 and 49 items
+2 more
mixey says

Guys, do you know a good way to filter wordpress post inside of the category view template?

What is the best way to give user to filter/order posts by date, popularity, style (set by tag or category)?

Thanks,

Michael

252 posts
  • Elite Author
  • Won a Competition
  • Has been a member for 4-5 years
  • Sold between 100 000 and 250 000 dollars
  • Exclusive Author
  • Bought between 10 and 49 items
  • Referred between 50 and 99 users
der says

I kinda don’t understand the question, but here’s the answer according to what I could understand :P

To filter the posts pertaining to a specific category, you need to create the category.php file, and then include The Loop inside it.

To filter by date, you can use the archive.php file, then including The Loop on it.

To filter by tags, then use the tag.php file.

If you want to have a better idea, have a look at the Template Hierarchy.

1840 posts YOU TOUCH IT YOU BUY IT
  • Bought between 100 and 499 items
  • Referred between 200 and 499 users
  • Has been a member for 4-5 years
  • Won a Competition
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
+1 more
FRESHFACE says
252 posts
  • Elite Author
  • Won a Competition
  • Has been a member for 4-5 years
  • Sold between 100 000 and 250 000 dollars
  • Exclusive Author
  • Bought between 10 and 49 items
  • Referred between 50 and 99 users
der says

ah right! :)

819 posts
  • Power Elite Author: Sold between 1 000 000 - 1 999 999 dollars
  • Power Elite Author
  • Won a Competition
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Europe
  • Bought between 10 and 49 items
+2 more
mixey says

Thanks for the suggestions, but that doesn’t looks like “the thing” I’m looking for.. :(

I need to have some kind of interface, where user with mouse will click “order by date” or “order by popularity”, “comment count”, “another parameter” – which could be set during the post creation.

Let’s imagine that I have a website with music bands, so the user should be able to filter/sort posts by genre, alphabetically and etc.

I hope I’ve explained better this time :)

252 posts
  • Elite Author
  • Won a Competition
  • Has been a member for 4-5 years
  • Sold between 100 000 and 250 000 dollars
  • Exclusive Author
  • Bought between 10 and 49 items
  • Referred between 50 and 99 users
der says

In that case you would need that integrated into the theme’s options, using a dropdown menu. You can then use the document that _freshface provided, to see the available sorting methods.

Then you perform the query with the option specified in the admin panel. For example, if you include an option that says ‘Order Posts by Date’, then its value would be ‘date’. Then on The Loop you would run

query_posts('orderby=' . $order_option);

In the example, $order_option is the value you retrieved from the theme’s options.

by
by
by
by
by
by