• Your plugin works fine. The only problem I have encountered is that in custom post types the default image is always shown. So if there is a custom post that already has a featured image, both this image and the default image are shown.

    It works fine with default WP posts.

    • This topic was modified 6 years, 3 months ago by fesarlis.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jan-Willem

    (@janwoostendorp)

    Hi fesarlis,

    This is the first time I hear anything like this.
    My first guess is that somehow an image is loaded twice, once for the custom post type, a second time may be faulty, which will default to my default featured image.
    If for the custom-post no featured image is set, does the default image still appear? Does it appear twice?

    What theme are you using?
    Can you share the part of the template that outputs the image?

    Thread Starter fesarlis

    (@fesarlis)

    Thank you for your reply.
    Will have to look it further. Have not examined the code yet. I will come back as soon as I have more info.
    But just to provide a temporary workaround. Can you provide some guidance to exclude specific custom post types from your plugin?

    Plugin Author Jan-Willem

    (@janwoostendorp)

    This code snippet will exclude the posttype “wiki”,
    Change to your own. I have some other scenarios in the FAQ section.

    function dfi_posttype_book ( $dfi_id, $post_id ) {
      $post = get_post($post_id);
      if ( 'wiki' === $post->post_type ) {
        return null; // no image
      }
      return $dfi_id; // the original featured image id
    }
    add_filter( 'dfi_thumbnail_id', 'dfi_posttype_book', 10, 2 );

    Let me know if you find something.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Default image always shown in custom post types’ is closed to new replies.