I need a conditional tag that will detect if there exists at least one post, in the same category as the current post, which has a specific custom field key/val pair.
In other words, I am on a page associated with one and only one category I've defined (say, dog, cat, or mouse). For example, I'm on a 'dog' page.
I'm trying to build a conditional tag that will display a given widget if, and only if, there exists a post, also in 'dog', with a custom field 'hair' with value 'long'.
The same conditional tag would also return true for 'long' 'hair' cats and mice articles.
I've wrestled with this all afternoon but my code is spectacularly failing to work. I think I'm badly mangling the get_posts() core function, but I just can't see it. Is this a solved problem for anyone here?