WordPress.org

Ready to get started?Download WordPress

Forums

display images in a post as a group in attachemnt (1 post)

  1. sannu3250
    Member
    Posted 3 years ago #

    this bellow code display all the images in all the post .. but i want to show only images in the there particular post and loop the images ... can you alter the code and make possible .. thanks in advance ..

    <?php

    $args = array(
    'post_type' => 'attachment',
    'numberposts' => -1,
    'post_status' => null,
    'post_parent' => null, // any parent
    );
    $attachments = get_posts($args);
    if ($attachments) {
    foreach ($attachments as $post) { ?>

  2. <?php
    setup_postdata($post);
    the_attachment_link($post->ID, true);
    ?>
  3. <?php
    }
    }

    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags