Loop to display ONLY custom taxonomy parent information


I’m looking to display only the top level categories from a custom post type taxonomy I’ve created… product-category.

I’m hoping to pull the following data into a loop:

  • Category title (the_title())
  • Category description (the_archive_description())
  • Permalink (the_permalink())
  • Thumbnail (custom field… the_field(category_thumbnail))

Could somebody point me in the right direction please.

Here’s my loop:

                $loop = new WP_Query();
                while ( $loop->have_posts() ) : $loop->the_post();
                    $myterms = get_terms( array( 'taxonomy' => 'taxonomy_name', 'parent' => 0 ) );
                    foreach( wp_get_post_terms() as $term ) { ?>
                        <div class="col-eq-height col-md-6" style="margin-bottom:30px;">
                            <div class="product">
                                <div id="thumbnail">
                                    <?php the_field('product_category_thumbnail'); ?>
                                <div id="content">
                                    <p id="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p>
                    <?php }
                endwhile; ?>
, , Jake Punton 3 years 2020-06-03T03:11:09-05:00 0 Answers 81 views 0

Leave an answer