• Resolved lee990

    (@lee990)


    Hi great plugin but i dont want a default image for pages, just posts?

    Can you offer a suggestion please?

    • This topic was modified 6 years ago by lee990.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter lee990

    (@lee990)

    Just thought i would add, i did try this in fuctions.php but it left a white space..

    // disable featured image for pages.
    if ( ‘page’ == get_post_type() ) {
    $status = false;
    }

    return $status;
    }

    add_filter( ‘dfi_thumbnail_html’ , ‘disable_feattured_image_for_posts’ );
    }

    Plugin Author Jan-Willem

    (@janwoostendorp)

    Hi Lee

    Yes you can with a small bit of code.
    Put in in your theme functions.php or create a small separate plugin.

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

    Let me know how it goes!

    Jan-Willem

    Thread Starter lee990

    (@lee990)

    WOW, that was fast,

    Thank you!

    Plugin Author Jan-Willem

    (@janwoostendorp)

    Hi Lee,

    You’re using a differens filter. And get_post_type() might not always use the correct post.

    Plugin Author Jan-Willem

    (@janwoostendorp)

    WOW, that was fast,

    Don’t get used to it 😉
    Glad to help.

    Thread Starter lee990

    (@lee990)

    Awesome – Don’t worry, I won’t. Have a great day!, btw, do you offer custom work?

    • This reply was modified 6 years ago by lee990.
    • This reply was modified 6 years ago by lee990.

    The code worked for me too, thanks!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Great Plugin bu need help with Pages’ is closed to new replies.