• How can I exclude the featured image AND an image specified in a custom field (“Location” for example) from this get_attachment query?

    <?php $args = array('numberposts' => -1, 'orderby' => 'menu_order', 'order' => 'ASC', 'post_type' => 'attachment', 'post_mime_type' => 'image','post_parent' => $post->ID); ?>
        <?php if ( $photos = get_posts($args) ) : ?>
            <div class="slides">
                <?php foreach ( $photos as $photo ) : ?>
                    <div class="slide">
                        <a href="<?php echo $photo->guid; ?>" class="lightbox" rel="community[<?php echo $post->ID; ?>]"><?php echo wp_get_attachment_image($photo->ID, 'thumbnail'); ?></a>
                    </div>
                <?php endforeach; ?>
            </div>
        <?php endif; ?>
  • The topic ‘Exclude featured image and custom field from get_attachment’ is closed to new replies.