• Resolved michaelware1205

    (@michaelware1205)


    Hello,
    I’m using the plugin to show a default featured image only for “Related Stories” at the bottom of a single post. How can I modify this function to not have default featured images show on the blog homepage, category or tag archives?

    `function dfi_category ( $dfi_id, $post_id ) {
    if ( has_category( ‘??’, $post_id ) ) {

    return 0; // default animals picture
    }
    return $dfi_id; // the original featured image id
    }
    add_filter( ‘dfi_thumbnail_id’, ‘dfi_category’, 10, 2 );`

    Thanks,
    Michael

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jan-Willem

    (@janwoostendorp)

    Change:

    if ( has_category( ‘??’, $post_id ) ) {

    into

    if ( !is_single() ) {

    This way it will only show on single posts. Not on pages, categories, tags, home and so on

    Thread Starter michaelware1205

    (@michaelware1205)

    Excellent. Thanks so much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hide default featured image on Blog Home, Category or Tag Archives’ is closed to new replies.