Support

Account

Home Forums General Issues Multiple custom post types by custom taxonomy on same page Reply To: Multiple custom post types by custom taxonomy on same page

  • So, i’ve tried using code like this, and still no luck

    
    <?php
    	$taxterms = get_field("collectiona"); ?>				
    									
    					<?php
    					$args = array(
    						'post_type' => 'products',
    						'tax_query' => array(
    							array(
    								'taxonomy' => 'product-collections',
    								'field' => 'id',
    								'terms' => $taxterm->term_id
    							)
    						)
    					);
    		
    					$myquery = new WP_Query( $args );
    					if($myquery->have_posts()) : ?>
    						<h2><?php the_field('prod_subtitle'); ?></h2>
    						<ul>
    							<?php while ( $myquery->have_posts() ) : $myquery->the_post(); ?>
    								<li> <a href="<?php the_permalink(); ?>"><img src="<?php the_field('prod_featured_image'); ?>" onmouseover="this.src='<?php the_field('prod_hover_featured_image'); ?>'" onmouseout="this.src='<?php the_field('prod_featured_image'); ?>'" /></a>
              <h2><?php the_field('prod_subtitle'); ?></h2>
              <p>$<?php the_field('prod_price'); ?></p>
            </li>
    							<?php endwhile; ?>
    						</ul>
    					<?php endif; ?>
    					<?php wp_reset_query(); ?>