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

    (@tw2113)

    The BenchPresser

    Should just work with all post types, from what I’m seeing and what I’ve just tested with locally.

    Are you not seeing images set for post type posts, but are for standard posts? Also could be an issue with the video being tested with, and if you provide that I can do some quick tests with that too.

    Thread Starter metaglyphics

    (@metaglyphics)

    Ah yes! It looks like the issue was just that I was embedding the video with an iframe, rather than just putting the video’s URL in the field!

    Works beautifully!

    Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    Awesome. Let us know if you need anything else ??

    Thread Starter metaglyphics

    (@metaglyphics)

    Will do! Thanks for the quick response.

    Hi,

    I am having an issue with Custom Post Types as well. This works fine on standard posts, but not with my custom post type.

    I am using ACF Plugin to create an oEmbed field type to store youtube links if that helps.

    Thanks in advance for your help.

    Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    @admlaw your case would be because by default we search the post content for the URLs, not meta data fields.

    However, you are able to change that with the filter located at the snippet below:

    https://github.com/WebDevStudios/Automatic-Featured-Images-from-Videos/blob/master/automatic-featured-images-from-videos.php#L103-L113

    You could use the filter and the passed in post ID variable to fetch your ACF field and return that instead of the default content string. Something like this:

    function admlaw_get_acf_youtube( $original_content, $post_id ) {
        // Fetch the field we store our URL in.
        $acf_field = get_field( 'my_field_id', $post_id );
        // Only return it if we have something and it's an actual string.
        if ( ! empty( $acf_field ) && is_string( $acf_field ) ) {
            return $acf_field;
        }
    
        // May as well just return the original content at this point.
        return $original_content;
    }
    add_filter( 'wds_featured_images_from_video_filter_content', 'admlaw_get_acf_youtube', 10, 2 );
    

    You’ll want to replace the “my_field_id” with your actual fields.

    Hi Michael,

    This worked! Thank you for your quick response!

    Plugin Support Michael Beckwith

    (@tw2113)

    The BenchPresser

    Welcome

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Custom Post Type Support?’ is closed to new replies.