838 posts
  • Became a Top 20 Author of the Month
  • Had an item that was trending
  • Had an item that became a weekly top seller
  • Power Elite Author: Sold more than $1M on Envato Market
+10 more
wpbakery
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

263 posts
  • Had an item that became a weekly top seller
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Won a competition
+6 more
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.

1899 posts YOU TOUCH IT YOU BUY IT
  • Had an item that became a weekly top seller
  • Became a Top 20 Author of the Month
  • Has sold $750,000+ on Envato Market
  • Won a competition
+10 more
FRESHFACE
says
263 posts
  • Had an item that became a weekly top seller
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Won a competition
+6 more
der
says

ah right! :)

838 posts
  • Became a Top 20 Author of the Month
  • Had an item that was trending
  • Had an item that became a weekly top seller
  • Power Elite Author: Sold more than $1M on Envato Market
+10 more
wpbakery
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 :)

263 posts
  • Had an item that became a weekly top seller
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Won a competition
+6 more
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