Drop down+sort blog posts date added/most popular

Yes, we can sort WordPress posts in different orders, You can do following sorts without installing plugins.

  1. sort post by date ( ascending / descending )
  2. Sort post by title (ascending / descending )
  3. Sort post by comment count ( ascending / descending )
    — These are just basic we can do even more using categories and tags etc

WordPress already stores the comment count in database but they can not store view counts, ratings / popularity data by default. You must use some kind of plugins to do that. Those plugin will store related data in database and that data can be further used for query.

EXAMPLES – These queries don’t need any plugins

  1. www.example.com/?orderby=date&order=asc
  2. www.example.com/?orderby=date&order=dsc
  3. www.example.com/?orderby=title&order=dsc
  4. www.example.com/?orderby=title&order=dsc
  5. www.example.com/?orderby=comment_count&order=asc
  6. www.example.com/?orderby=comment_count&order=dsc

Using custom field values for sorting as per View count / Popularity / Ratings,
To work this you must install related plugin which store view count as a custom field value.

To Sort by View Count

first install this plugin – WP PostViews

EXAMPLES 3 – Links to sort by view count

  1. www.example.com/?v_sortby=views&v_orderby=dsc
  2. www.example.com/?v_sortby=views&v_orderby=asc

Update 1 – july/10

If you are using GD star rating plugin and want to sort the posts according to their ratings here is more info – http://www.gdstarrating.com/2009/07/03/how-to-reorder-posts/

HOW TO USE –
Use links or buttons to those urls and then WordPress will manage all other things.

Leave a Comment