How to make orderby ‘meta_value_num’ OPTIONAL?
Short answer: You can’t. Not like that, anyway. You could, however, grab all of the results from your query, regardless of the presence of that custom field, and completely unsorted, and then sort them using the PHP function uksort http://us1.php.net/manual/en/function.uksort.php Something like: $args = array( ‘cat’ => 5, ‘numberposts’ => 8 ); $posts = get_posts($args); … Read more