Using WP_Query – how to display something IF there are no results
So, let’s say $query is your WP_Query object. I.e. $query = new WP_Query($some_query_args ); Then you can set up ‘the loop’, by $query->get_posts(); Then to check if there are actually any returned results: if ( $query->have_posts() ) : //Use a While loop to show the results else: //No results, let’s show a message instead. //This … Read more