Is there any way to modify the WordPress query to add in a calculated field? I want to order the post based on what is in the post title so that any posts that contains "GOLD" will appear first in random order, "SILVER" will appear next in random order and then all other posts.
The query would look like this:
SELECT *,
IF(post_title LIKE '%GOLD%',FLOOR(RAND()*(999999-500000+1))+500000,post_title LIKE '%SILVER%',FLOOR(RAND()*(499999-1+1))+1,0)) AS post_order
FROM wp_posts
ORDER BY post_order DESC
I looked at query_posts() to achieve this but it does appear to do what I would like.