I need to create a page template that shows the categories of some customs posts (events) I want to make a page template that shows the categories of some customs posts (events), which I have created with the plugin "Event Manager and Tickets Selling Plugin for WooCommerce - WpEvently - WordPress Plugin" I am attaching the code I made for the template: <div class="mep-events-wrapper"> <div class=''> <h1>Cursos</h1> <div class='mage_grid_box'> <?php $wcatTerms = get_terms('mep_cat', array('hide_empty' => true, 'number' => 'all', 'order' =>'asc', 'parent' =>0, 'upcoming')); foreach($wcatTerms as $wcatTerm) : ?> <div class="<?php echo $wcatTerm->name; echo $status->$params['status']; ?>"> <div class="thumbnail-image-category"> <a href="<?php echo get_term_link( $wcatTerm->slug, $wcatTerm->taxonomy );?> "> <?php /* The image */ ?> </a> </div> <a href="<?php echo get_term_link( $wcatTerm->slug, $wcatTerm->taxonomy ); ?>"> <?php echo $wcatTerm->name; ?> </a> </div> <?php $args = array( 'post_type' => 'mep_events', 'order' => 'ASC', 'tax_query' => array( array( 'taxonomy' => 'cursos', 'field' => 'slug', 'terms' => $wcatTerm->slug, ) ), 'posts_per_page' => 1 ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); $imgurl = get_the_post_thumbnail_url( get_the_ID(), 'full' ); $title=get_the_title($post->ID); ?> <?php endwhile; wp_reset_postdata(); ?> <?php endforeach; ?> </div> But I can't get the thumbnail images for each category to show. I would also like, if possible, to be able to detect if the categories contain events without available places, so that the category is not displayed. In short, it would achieve something similar to a WooCommerce page, where the categories are displayed, only if there are products in stock.