Support » Plugin: Default featured image » Is possible to set up different default images for different CPTs?

  • Resolved gfdesign

    (@gfdesign)


    Dear support
    Your plugin does what promises but I see is very limited.
    I’d like to be able to set up different default image by Custom Post Type?
    Do you have any custom code to solve that?
    Thanks a lot
    Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author janw.oostendorp

    (@janwoostendorp)

    Hi gfdesign,

    It’s a conscious choice, I didn’t want to complicate the UI.
    It can be done I have more examples in the FAQ.

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

    This example will set a different image ID for the wiki posttype.

    Let me know if you need more help!

    @janwoostendorp Thanks so much for your code.
    This works as expected.
    Please, consider to add my suggestion in future versions.
    I’ve left my five stars review.
    Regards from Argentina

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Is possible to set up different default images for different CPTs?’ is closed to new replies.