I think I've got this figured out and I'd like to make sure I'm not missing anything obvious.
My goal is to prioritize a list of results by custom posts with attachments. So, I have a query returning say 60 results and, of those 60, 40 have attachments. I'd like those to show first, then continue with the posts that don't have any attachments.
Given the limitations of the "orderby" parameter my method of attack is as follows:
Create a custom field ("has_attachment") that is updated "true" if the post has any attachments. Tie the update into an action (e.g. "attachment_fields_to_save").
Run a query to set the value to true on posts that already have attachments.
I would like to make this bulletproof and go so far as to empty the field in the event that all attachments to the post are deleted. That's not necessary in my use-case, though, as the likelihood is slim.
Anyway, I'd like to see if any of you have suggestions for improving my method or ideas for a different way to approach this. Otherwise, I'll get to work!
usorton your results. But without seeing code, it's guessing and theory. – kaiser Feb 26 '12 at 23:23