Custom Taxonomy Archive BUG
I'm hoping that Its just my tired eyes missing something and a fresh pair of eyeballs might catch what I'm missing.
I have a custom taxonomy with a slug of 'residential_project_types' that is assigned to a custom post type of residential_projects. I want to display all terms from the taxonomy, outputting the term name and link.
Its KIND OF working...
Instead of displaying a single term for each, it appears to be displaying a term for every post included in the term. This of course is creating duplicates. In addition, the HTML isn't displaying properly, causing weird overlapping of elements.
My hunch is something is messed up with the loop...? Haven't been able to figure it out though. Any and all helped is much appreciated!
Here's a link to the broken/buggy page: http://desarch.robertrhu.net/residential/
Here's the code I've written:
?php
$terms = get_terms( array(
'taxonomy' = 'residential_project_types',
'orderby' = 'count',
'hide_empty' = false,
'fields' = 'all'
) );
?
?php
foreach( $terms as $term ) {
$args = array(
'post_type' = 'residential_projects',
'residential_project_types' = $term-slug
);
$term_link = get_term_link( $term );
$query = new WP_Query( $args );
if ( $query-have_posts() ) :
/* Start the Loop */
while ( $query-have_posts() ) : $query-the_post(); ?
a class="property-thumb-link"
href="?php echo $term_link; ?"
div class="property-thumb column medium-6 small-12"
img src="?php the_field('category_image', $term); ?"
alt="?php the_field ('category_image_alt', $term); ?" /
div class="property-thumb-title"
h2
?php echo $term-name; ?
/h2
/div
/div
/a
?php wp_reset_postdata();
endwhile;
endif; }?
Topic wp-parse-args archive-template terms custom-taxonomy Wordpress
Category Web