• Resolved glarts

    (@glarts)


    Hello,

    We recently installed this plugin to ensure that we have an image on all posts. I recently noticed that the plugin is also affecting Testimonials that we have. This causes an image to show up on the slider widget on the home page. I have tried many of the fixes posted in the forum and the FAQ, but I cannot find a working fix. I applied a category to those posts (Testimonial, slug is ‘testimonial’). I would like some code to use to skip a default image completely on that category.

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter glarts

    (@glarts)

    this is the current code i tried

    function dfi_posttype_book ( $dfi_id, $post_id ) {
    $post = get_post($post_id);
    if ( ‘category’ === $post->testimonial ) {
    return 0; // invalid id
    }
    return $dfi_id; // the original featured image id
    }
    add_filter( ‘dfi_thumbnail_id’, ‘dfi_posttype_book’, 10, 2 );

    • This reply was modified 7 years ago by glarts.
    Plugin Author Jan-Willem

    (@janwoostendorp)

    You are close, you need has_category

    function dfi_skip_testimonial ( $dfi_id, $post_id ) {
        if ( has_category( 'testimonial', $post_id )) {
            return 0; // invalid id
        }
        return $dfi_id; // the original featured image id
    }
    add_filter( 'dfi_thumbnail_id', 'dfi_skip_testimonial', 10, 2 );
    • This reply was modified 7 years ago by Jan-Willem.
    Thread Starter glarts

    (@glarts)

    It worked! Thank you! I had something similar to this from one of your other support posts but couldn’t get it quite right.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Skip Category’ is closed to new replies.