Apply Taxonmy filter in custom loop
-
Hey, I wrote a custom Loop in order to display my products.
I already created custom post types and categories.
Now I would like to apply a taxonomy filter
in order to display only products of a certain category.
How can I do this ?
Here is my code:
<?php /** * Template name: Sortiment Loop */ get_header(); ?> <?php get_sidebar(); ?> <?php wp_nav_menu (array ( 'theme_location' => 'secondary') ); ?> <div id="primary" class="site-content"> <div id="content" role="main"> <?php $args = array( 'post_type' => 'products','posts_per_page' => 10 ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); the_title('<h2>', '</h2>'); echo '<div class="entry-content">'; the_content(); echo '</div>'; endwhile; ?> <?php if (has_post_thumbnail()) { $image_url = wp_get_attachment_image_src(get_post_thumbnail_id(),'large', true); echo ''; the_post_thumbnail(); echo ''; } else { echo ''; } ?> </div><!-- #content --> </div><!-- #primary -->
Thanks you very much,
vince
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Apply Taxonmy filter in custom loop’ is closed to new replies.