• Hi,

    i am trying to exclude multiple post thumbnails from attachments.

    i have the following thumbnails setup:

    $thumb = new MultiPostThumbnails(array(
        'label' => 'Client Logo',
        'id' => 'client-logo',
        'post_type' => 'clients'
        )
    );
    
    $thumb = new MultiPostThumbnails(array(
        'label' => 'Portfolio Home Image',
        'id' => 'port-home-image',
        'post_type' => 'clients'
        )
    );
    
    $thumb = new MultiPostThumbnails(array(
        'label' => 'Home Slide Image',
        'id' => 'home-slide-image',
        'post_type' => 'clients'
        )
    );

    i then have the following code, within the loop to pull in all image attachements and disaply them

    <?php
    	  $thumb_id = get_post_thumbnail_id( $post_id );
          $args = array(
          'post_type' => 'attachment',
          'numberposts' => $nimg,
    	  'post_mime_type' => 'image',
          'post_status' => null,
          'post_parent' => $post->ID,
    	  'exclude' => $thumb_id
          );
          $attachments = get_posts($args);
          if ($attachments) {
          foreach ($attachments as $attachment) {
          //echo apply_filters('the_title', $attachment->post_title);
          echo wp_get_attachment_image( $attachment->ID, array (650,650));
    
         }
          }
    
    ?>

    this line: $thumb_id = get_post_thumbnail_id( $post_id ); excludes the featured post thumbnail.

    any ideas on how i can exclude my 3 other thumbnails?

    any help would be greatly appreciated.

    Thanks Danyo

    http://ww.wp.xz.cn/extend/plugins/multiple-post-thumbnails/

The topic ‘Exclude Multiple Post Thumbnails From Attachments’ is closed to new replies.