• Hi all,

    I’m trying to create a list of images, using my own “sizes”. Something like
    wp_get_attachment_link ( $attachment->ID, 'header' );
    comes close, but it returns the header-image and link to the large (original) image. I don’t need the link, I want the URI – and that of it’s smaller brother (‘navthumb’).

    The following is als very close, but only returns the results of ONE attachment and not all.

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post();
    
            $args = array(
              'post_type' => 'attachment',
              'numberposts' => -1,
              'post_status' => null,
              'post_parent' => $post->ID
              );
    
            $attachments = get_posts( $args );
              if ( $attachments ) {
                foreach ( $attachments as $attachment ) {
    
         $header_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID),'header');
         $thumb_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID),'navthumb');
     echo $header_image_url[0];
     echo $thumb_image_url[0];
    
            endwhile; endif; ?>

    Anyone?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Attachment galore’ is closed to new replies.