No idea how to title this so feel free to edit. I set out to create a "hotness" for my posts and to do this I used the $ratings_score which is stored as post_meta as a number +/- and the days ago of the post which I trimmed down to just the days. I divided the ratings_score by the days to get a number which reflects the hotness of the post. I ran this function inside the loop to get the result...
$time_ago = human_time_diff( get_the_time('U'), current_time('timestamp') ); if (strtotime($time_ago) < strtotime('1 day')) { $time_ago = "1"; } $days_ago = preg_replace("/[^0-9 ]/", '', $time_ago); $days_ago; $ratings_score = get_post_meta($post->ID,'ratings_score',true); $hotness = $ratings_score / $days_ago; echo $hotness; That works fine but what I really need to do is make this into a function in my functions.php and store $hotness as post_meta. I need it to constantly update itself aswell based on the changing of the days ago and $ratings_score. So then I can sort my loop by the $hotness meta_key. How can I do that?
ratings_scoremade of?