• Resolved Purple Hippo

    (@purplebabyhippo)


    The Featured Images for Custom Post Types archive option was only displaying this image on the archive page, however with the latest plugin update, this image is now also displayed on all the single Custom Post Type pages.
    I only want it to be displayed on the archive page. Is there a way that I can remove them from the single custom post type pages?

    https://wordpress.org/plugins/display-featured-image-genesis/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Robin Cornett

    (@littlerchicken)

    Yes, that was an oversight in 2.0 that was fixed in 2.1. If you do not want the plugin to show an image if there is no featured image set for the individual CPT, though, you’d use the skipped post types filter. Here’s an example of how that might look:

    add_filter( 'display_featured_image_genesis_skipped_posttypes', 'rgc_skip_post_type_no_thumb' );
    function rgc_skip_post_type_no_thumb( $post_types ) {
    	if ( ! has_post_thumbnail() ) {
    		$post_types[] = 'your_post_type';
    	}
    
    	return $post_types;
    }

    So if the CPT has a featured image, it will use it, otherwise, it will show no image. If you’ve set a sitewide default featured image instead, you could use the above with the display_featured_image_genesis_use_default filter instead, and the CPT would use the default featured image instead of the CPT featured image. (you could also do $post_types[] = is_singular( 'your_post_type' ); in the above without the thumbnail conditional, if you just want the single CPT entries to never have the plugin output, period)

    Thread Starter Purple Hippo

    (@purplebabyhippo)

    Many Thanks Robin, this works. I also do not want the featured image plugin to be applied to my single blog posts, but just want the featured images displayed as per my theme (medium size to the left) is this possible?

    Thread Starter Purple Hippo

    (@purplebabyhippo)

    Don’t worry, I’ve done it by adding add_action( ‘genesis_entry_content’, ‘pbh_show_featured_image_single_posts’, 9 );

    after the above filter.

    many thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remove featured image from single CPT post’ is closed to new replies.