Getting Same Description in All the Custom Taxonomy Posts


I have developed a custom taxonomy post type. I have displayed categories & inside categories posts/(products).

I am getting the Post title & Image as they should be (which I add), but the descriptions of all the posts are same.

I have no idea why same desc keeps displaying,even though everything else is dynamic.

Here is the code I am using:

$taxID = get_queried_object()->term_id;
$args = array(
    'post_type' => 'industrial_product',
    'fields' => 'ids',
    'posts_per_page' => -1,
    'tax_query' => array(
            'taxonomy' => 'industrial_product_cat',
            'terms' => $taxID,
            'field' => 'term_id',
            'operator' => 'IN'
     $query = new WP_Query($args);
    if ($query->have_posts()):
    foreach( $query->posts as $id ):?>
            <div class="row mb-4">
                <div class="col-md-4 col-12">
                    $image_palette = wp_get_attachment_image_src( get_post_thumbnail_id( $id ), 'single-post-thumbnail' ); 
                <img src="<?php echo $image_palette[0]; ?>" alt="" class="img-fluid" style="max-width:100%;">
                <div class="col-md-8 col-12">
                     <ul class="nav nav-tabs" id="myTab" role="tablist">
                        <li class="nav-item m-0" role="presentation">
                            <a class="nav-link active  c-2" id="productInfo<?php echo $i;?>-tab" data-toggle="tab" href="#productInfo<?php echo $i;?>" role="tab" aria-controls="productInfo<?php echo $i;?>" aria-selected="true">Product Information</a>
                        <li class="nav-item m-0" role="presentation">
                            <a class="nav-link  c-2" id="std_tds<?php echo $i;?>-tab" data-toggle="tab" href="#std_tds<?php echo $i;?>" role="tab" aria-controls="std_tds<?php echo $i;?>" aria-selected="false">STD / TDS</a>
                    <div class="tab-content p-3" id="myTabContent<?php echo $i;?>">
                        <div class="tab-pane fade show active" id="productInfo<?php echo $i;?>" role="tabpanel" aria-labelledby="productInfo<?php echo $i;?>-tab">
                            <h5><?php echo get_the_title($id); ?></h5>
                            <p><?php echo get_the_content($id); ?></p>
                        <div class="tab-pane fade" id="std_tds<?php echo $i;?>" role="tabpanel" aria-labelledby="std_tds<?php echo $i;?>-tab">
                                if(get_field('std_tds_description', $id)){
                                    the_field('std_tds_description',  $id);
                                    echo "No, Content.";

Here is a screenshot of the result:

enter image description here

Can somebody point out what is the problem here. I’ve tried all sort of stuff but It still shows same desc.
Thanks & Sorry If I’m doing something stupid, still learning!

Hasnain Ghias 1 year 2022-02-19T02:08:10-05:00 0 Answers 0 views 0

Leave an answer