• Resolved plop_suey

    (@plop_suey)


    This is probably something simple I’m overlooking, but I cannot figure out the correct answer. I am trying to display 2 woocommerce category links out of the 15 categories in my store. Their IDs are 144 & 146. My query is below. I’m just not sure if I should have a query_vars before the loop, or if there is an argument I can put in the array to restrict it to showing those 2 categories. Any help would be appreciated.
    Thanks

    <?php
    $prod_cat_args = array(
    'taxonomy'     => 'product_cat',  
    'orderby'      => 'name',
    );
    
        $terms = get_categories( $prod_cat_args );
    	foreach ( $terms as $term ) {
    	$term_link = get_term_link( $term );
    	echo '<li><a href="' . esc_url( $term_link ) . '">' . $term->name . '</a></li>';
    }
    ?>
    • This topic was modified 6 years, 6 months ago by plop_suey.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Trying to display only 2 of my WooCommerce category links’ is closed to new replies.