Friday, January 6, 2023
HomeWordPress Developmenttheme improvement - Displaying all photographs from a WordPress submit (together with...

theme improvement – Displaying all photographs from a WordPress submit (together with media library)


With this perform, I am getting solely these photographs that I uploaded utilizing the add button within the submit part. However, if I add a picture from the media library in a submit, it is now exhibiting. I need to present all the pictures from the submit.

$attachments = get_children(array(
          'post_parent' => $post->ID,
          'post_status' => 'inherit',
          'post_type' => 'attachment',
          'post_mime_type' => 'picture',
          'order' => 'ASC',
          'orderby' => 'menu_order ID'));

          foreach($attachments as $att_id => $attachment) {
            $full_img_url = wp_get_attachment_url($attachment->ID);
            echo wp_get_attachment_image($attachment->ID, 'full');
           
          }

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments