Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter pinokio

    (@lapanwebsite)

    function dfi_posttype_page ( $dfi_id, $post_id ) {
    $post = get_post($post_id);
    if ( ‘page’ === $post->post_type ) {
    return 0; //invalid ID
    }
    elseif ( ‘post’ === $post->post_type ) {
    return 0; //invalid ID
    }
    return $dfi_id; // the original featured image id
    }
    add_filter( ‘dfi_thumbnail_id’, ‘dfi_posttype_page’, 10, 2 );

    Plugin Author Jan-Willem

    (@janwoostendorp)

    Yep that’s it. It can be a bit shorter.

    function dfi_posttype_page ( $dfi_id, $post_id ) {
      if ( is_single($post_id) || is_page($post_id) ) {
        return 0; //invalid ID
      }
      return $dfi_id; // the original featured image id
    }
    add_filter( ‘dfi_thumbnail_id’, ‘dfi_posttype_page’, 10, 2 );
    • This reply was modified 7 years, 11 months ago by Jan-Willem.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove from single pages posts….’ is closed to new replies.