• Resolved luuuciano

    (@luuuciano)


    Hi!

    I am using a theme called neptune, it uses the regular way to exclude the Feature Image on contents (it build a slider in a “portfolio” item)

    That section code looks like this:

    //get attachement count
                        $get_attachments = get_children( array( 'post_parent' => $post->ID ) );
                        $attachments_count = count( $get_attachments );
                        $thumb_ID = get_post_thumbnail_id( $post->ID ); //set current featured image ID
                        $feat_full_img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full-size');
    
                        //attachement loop
                        $args = array(
                            'orderby' => 'menu_order',
                            'post_type' => 'attachment',
                            'post_parent' => get_the_ID(),
                            'post_mime_type' => 'image',
                            'post_status' => null,
                            'posts_per_page' => -1,
                            'exclude' => $thumb_ID
                        );
                        $attachments = get_posts($args);

    Something changed on recent wordpress versions? (3.6.x)

    Because it is still showing the Featured Image… and I have uploaded it using the Media manager, not attached to the portfolio item…
    I have installed the Unattach plugin too, just to check… and the featured images are NOT attached to any portfolio item…

    Any idea?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    Not sure what is going on but try it with

    $args = array(
    	'orderby'        => 'menu_order',
    	'post_type'      => 'attachment',
    	'post_parent'    => get_the_ID(),
    	'post_mime_type' => 'image',
    	'posts_per_page' => -1,
    	'post_status'    => 'inherit',
    	'post__not_in'   => array( $thumb_ID ),
    );

    Thread Starter luuuciano

    (@luuuciano)

    Thanks keesiemeijer, but it shows the same result…

    It is a problem because we want to use an image almost icon size as featured one… and it breaks the slider (and looks really bad, lol)

    Thread Starter luuuciano

    (@luuuciano)

    Oops, sorry… after looking at the code logic… it seems like it always want to show the Featured Image… so, no idea why then uses the exclude section…
    Maybe a copy & paste.

    Thanks, and sorry!
    Will try to change it to not show it at first

    Moderator keesiemeijer

    (@keesiemeijer)

    Are you using this inside the loop, where the post ID is available.
    Try printing the ID:

    echo 'post ID = ' . $post->ID;
    echo 'post parent = ' . get_the_ID();

    Moderator keesiemeijer

    (@keesiemeijer)

    No problem ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘The way to exclude Featured Image have changed on 3.6.x?’ is closed to new replies.