Dynamic variable for custom taxonomy in loop?
-
I have a custom page template that loops through all custom posts with the post_type of “product_listing” AND the custom taxonomy “product_cat” of “shirts” and returns 4 posts per page (as seen below:)
<?php $loop = new WP_Query( array( 'post_type' => 'product_listing', 'product_cat' => 'shirts', 'posts_per_page' => 4 ) ); ?>
It is the client’s responsibility to manage those categories. I’d like to assign a variable to display in place of “shirts” so that I don’t have to modify the template each time the client adds a new product category (such as shoes, pants, etc.).
I am not a programmer by any means. Does anybody have a snippet of code that would work for this? Or perhaps an article I could read more about assigning dynamic variables in the loop? Thanks!
Viewing 15 replies - 1 through 15 (of 15 total)
Viewing 15 replies - 1 through 15 (of 15 total)
- The topic ‘Dynamic variable for custom taxonomy in loop?’ is closed to new replies.