How to order results by date and meta key?

You could do this by sorting on a calculated factor. Dividing the rating by the days gives a good starting point:

rating/days = factor (e.g. 15/6 = 2.5 or 11/3 = 3.6)

You can balance this to your needs by multiplicate the variables (rating and day) with any factor you like.

There are to ways to implement such a factor:

  1. use wp-crons to hourly refresh the factor for each post and save the value as postmeta. So you can easily use a WP_Query and sort the posts by the meta_value_num.
  2. calculate the factor directly in your post-loop

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)