Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am looking for this answer everywhere and can't find it. I setuo the wordpress default gallery using the attachment page which shows next and previous photos. everything is working fine and I have a loop of gallery with next and previous image post.

now, inside the gallery page where I uploaded all the photos I also added a "featured image" for a reason that I am using. unfortunately, it added this photo to my gallery loop as the last photo. I would like to exlclude the "Featured Image" from showing anywhere in the gallery (I use it only for a certain purpose)

I was looking at the code in the attachment.php and found this line which represents the photos:

<a href="<?php echo $next_attachment_url; ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
                            $attachment_size = apply_filters( 'twentyten_attachment_size', 900 );
                            echo wp_get_attachment_image( $post->ID, array( $attachment_size, 9999 ) ); // filterable image width with, essentially, no limit for image height.
                        ?></a>

I have no idea how to exclude it. can anyone help? any maybe function that does it? Thanks a lot

Gil

share|improve this question
    
Are you using the [gallery] shortcode for this? I'm unclear. (You're also going to have a hard time getting good answers until you get that 0% accept rate up.) –  mrwweb May 23 '12 at 16:53
    
We need to see the code that is actually outputting the gallery. –  Chip Bennett May 23 '12 at 19:02
    
mrwweb - I am using the [gallery] shortcode but what I am talking about is not in the gallery template. it's inside a photo post after clicking on a picture in the gallery. also, please let me know how do I increase my rate. Thanks a lot –  gil hamer May 24 '12 at 5:51
    
Chip Bennett - I just put this small portion of the code that actually creates the photos loop. the entire code can be found inside attachment.php here is a link to the file: dl.dropbox.com/u/4405634/attachment.php Thanks a lot –  gil hamer May 24 '12 at 5:52
add comment

1 Answer 1

So finally I managed to sort of fix it myself and wanted to share it if anyone finds it helpful. not the best solution in the world but still.. just uploaded the image via the Media section and not from within the post/page and then used it in the post as a featured image which wasn't uploaded directly from there, therefore, it wasn't included in the gallery pictures loop.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.