If I understand you correctly, you need to show all posts from a term when a term’s page is being displayed.
Before I answer the real question, there are a few points I would like to highlight since you are new to WordPress
-
Never use hyphens (
-
) to separate names in custom post type names and custom taxonomy names. They are extremely troublesome later, specially when it comes to custom templates. If you really need to separate names, only use underscores (_
) -
Don’t create multiple instances that are hooked to the same hook. Add all relevant functions in one function and add that one function to the desired hook
OK, now for the real problem. Your problem is the custom query. You should never change the main query for a custom query on any archive type page or the home page. If you need to manipulate the main query on these pages, rather use pre_get_posts
to do so.
To solve your problem, just go back to the default loop on archive.php. You can also create a taxonomy.php template which will be used instead for custom taxonomies
Here is an example of how your archive or taxonomy page should look like
<?php
get_header(); ?>
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php if ( have_posts() ) : ?>
<?php
// Start the Loop.
while ( have_posts() ) : the_post();
get_template_part( 'content', get_post_format() );
endwhile;
// Previous/next page navigation.
//YOUR PAGINATION FUNCTIONS;
else :
// If no content, include the "No posts found" template.
get_template_part( 'content', 'none' );
endif;
?>
</div><!-- #content -->
</section><!-- #primary -->
<?php
get_sidebar();
get_footer();
ADDITIONAL READING
EDIT
Just on your updated code, there are two problems. (I still don’t see why you are not making use of the above solution, you are over-complicating things here)
-
In your
tax_query
, you are retrieving the term byslug
, yet you are feeding the term name to it. You will need to change your field toname
-
When using
WP_Query
, you will need to make use ofwp_reset_postdata()
to reset your query, notwp_reset_query()
as this is used in conjuction withquery_posts