Taxonony loop not displaying results


I seem to be missing something simple. I have registered a custom post type and taxonomy, and my navigation is working fine, and calling the right template, however, the results are not showing.

So, I have post type - service, and a taxonomy called “service_type”.

So, “PHP Development” would be a service, the taxonomy “service_type” would be “Technology” for example.

So, I have taxonomy-services.php which has this:

<?php get_template_part('templates/content-taxonomy-services', 'service_type'); ?>

In my templates/content-taxonomy-service_type.php file I have"

use Roots\Sage\Assets;

$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );

echo "<PRE>";

while( have_posts() ): the_post();

So the $term being passed to the template it working fine, and from the count I can see the correct number of “Service” posts that have been associated with that term.

The problem is that have_posts() always returns false, as though the main loop query is not being set.

Am I missing something??