Home Forums General Issues Post type = product per single product Reply To: Post type = product per single product

  • Basically, you would delete the custom query and it’s associated loop and you would only need the code that starts with

    $post_objects = get_field('featured_products');

    and the loop associated with this field.

    This would show posts associated with the current product.

    You would keep this, but it may need some adjustments

    $post_objects = get_field('featured_products');
    			if( $post_objects ): ?> 
    			<h1>You may also like</h1>
    				<?php foreach( $post_objects as $post_object): ?>
    					<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
    					   <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post_object->ID ), 'single-post-thumbnail' );  ?>
    						<div class="single-feature">
    								<a href="<?php echo get_the_permalink($post_object->ID); ?>" class="img-feature">
    								 <img src="<?php echo $image[0];?>">
    							<div class="product-title-price">
    								<a href="<?php echo get_the_permalink($post_object->ID); ?>">
    								<h3><?php echo get_the_title($post_object->ID); ?></h3>
    								<?php echo $price; ?>
    				<?php endforeach;