WordPress.org

Ready to get started?Download WordPress

Forums

How to detect 'exclude attachment' values (1 post)

  1. RyanWilliams
    Member
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic