How to detect ‘exclude attachment’ values
My clients likes to use the new ‘exclude’ shortcode to hide certain images from his gallery. Unfortunately when you’re viewing the actual attachments, the previous/next links and list of thumbnails (should you be doing this) seem to include the excluded images.
Is there a way to get around this by detecting the parent post’s exclude values and applying them to these variables, or is this an oversight?
For example here is what I use to generate a list of thumbnails of the whole gallery while viewing a single attachment (I’ve hardcoded the excludes here, wheras ideally it should automatically fetch them from the post):
$args = array( 'exclude' => '514, 516, 521, 522, 523, 526, 601', 'numberposts' => -1, 'order' => 'asc', 'post_parent' => $post->post_parent, 'post_status' => null, 'post_type' => 'attachment' );
While I can accept my bespoke functionality here not working, it seems like the prev/next buttons should definitely ignore excluded images.
- The topic ‘How to detect ‘exclude attachment’ values’ is closed to new replies.