Support General Problem retrieving image data using image_upload meta field in while loop Reply To: Problem retrieving image data using image_upload meta field in while loop

#13657
baraanajjar@gmail.com[email protected]
Participant

Hi There i am passing ids correctly it show correctly the problem is the function called second time not work for the post id
also i am using somehting like

global $post;
                if($get_result){
                foreach($get_result as $post){ 
                setup_postdata($post);
                get_template_part( 'template-parts/item/row-my-request-ad-item' );
                }
                } else {
                echo '0';
                }

inside template file have this code

$list_id = get_the_ID();
   //////////////////////////get category details///////////////////////////////////////////////////////
   $cat_terms = wp_get_post_terms( $post->requesting_post_id, 'list_category', array( 'fields' => 'all','parent'=> 0 ) );
    foreach($cat_terms as $cat_term):
     $term_name = $cat_term->name;
     $term_image = get_wp_term_image($cat_term->term_id);
    endforeach;
    //////////////////////////get category details///////////////////////////////////////////////////////
    $additional_detail_value = rwmb_meta( 'additional_detail','',$post->requesting_post_id);
    $looking_for = rwmb_meta( 'looking_for','',$post->requesting_post_id);
    $city = rwmb_meta( 'city','',$post->requesting_post_id);
    
    ////////////////GET MAIN IMAGE///////////////////////////////////////////////////////////////////////
    $main_images = rwmb_meta( 'gallery_upload', array( 'size' => 'full', 'limit' => 1 ) ,$post->requesting_post_id );
    $main_image = reset( $main_images );
    ///////////////////GET ALL IMAGES/////////////////////////////////////////////////////////////////
    $gallery_images = rwmb_meta( 'gallery_upload', array( 'size' => 'thumbnail' ) ,$post->requesting_post_id );
    $count_gallery_images = count($gallery_images);
    ///////////////////////////////////////REQUESTING POST LISTING DETAILS//////////////////////////////////////////////////////////
    /////////////////////////MY ITEM MAIN/////////////////////////////////////////////////////////////////////////////
    
    $my_main_images = rwmb_meta( 'gallery_upload', array( 'size' => 'full', 'limit' => 1 ) ,$list_id );
        $my_main_image = reset( $main_images );