query_posts and only show results if a custom field is not empty
Try this code: $args = array( ‘posts_per_page’ => ’10’, ‘post_type’ => ‘programmes’, ‘meta_key’ => ‘popularityfig’, ‘meta_value’ => ”, ‘meta_compare’ => ‘!=’, ‘order’ => ‘DESC’ ); There’re 2 arguments you might want to note in the code: meta_value and meta_compare. Using meta_compare with operator != will exclude posts with empty meta value.