• Resolved adiehl

    (@adiehl)


    Hi, 

    is there a way to limit the feature for the “Automatic Featured Images from Videos” plugin to specific post types only?

    Thanks,
    Andreas

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

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hi @adiehl

    You could do something like this:

    function wds_featured_images_from_video_filter_content( $content, $post_id ) {

    // Fill in the post type slugs you want this to work for.
    $wanted_post_types = [
    'movie',
    'tv_show',
    ];
    // Get the post type of the current post.
    $post_type = get_post_type( $post_id );

    // It's of a post type we want this to work with.
    if ( in_array( $post_type, $wanted_post_types ) ) {
    return $content;
    }

    // It was not a post type we wanted, short circuit by returning empty string.
    return '';
    }
    add_filter( 'wds_featured_images_from_video_filter_content', 'wds_support_limit_by_post_type', 10, 2 );
    Thread Starter adiehl

    (@adiehl)

    Thanks Michael for the fast reply, we will give this a shot.

    Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    Welcome.

    Thread Starter adiehl

    (@adiehl)

    we tried but this leads to an error which usually points to an issue with the WP Api and the GB block editor?

    This is a screenshot

    • This reply was modified 8 months, 3 weeks ago by adiehl.
    Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hard to say without knowing anything about the actual errors being potentially logged. I’m not managing to recreate an editor error like that thus far.

    Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    @adiehl Did you get this figured out?

    Thread Starter adiehl

    (@adiehl)

    No, we could make it work and have abandoned the plugin, going back to a manual process for video thumbnails.

    Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    Noted and understood. Thanks for the followup nonetheless. It’s appreciated.

    Thread Starter adiehl

    (@adiehl)

    you are welcome. What might be beneficial is a setting to opt in for post types to which the feature is applied.

    Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    Opened and enhancement issue for this topic over at https://github.com/WebDevStudios/Automatic-Featured-Images-from-Videos/issues/73

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Limit to Post Types’ is closed to new replies.