• Resolved nata-lee

    (@nata-lee)


    Hello, this is a very nice and useful plugin!

    I need to make featured image from video thumbnails only for video post format. In the settings page there is only a post type option, and there is no post format option. I didn’t find this filter at the PRO version of the product.

    Could you, please, include this option?

    The workaround I use now is to change 296 line at the video-thumbnails.php:
    if ( $this->settings->options['set_featured'] == 1 && $this->settings->options['save_media'] == 1 && has_post_format('video') ) {

    https://www.ads-software.com/plugins/video-thumbnails/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Sutherland Boswell

    (@sutherlandboswell)

    I may add this option eventually, but I’d need to consider hiding the meta box on the fly when the post format is changed.

    Thread Starter nata-lee

    (@nata-lee)

    Hello! Have you any plan to add the option? Or filter that I could use in my functions.php? It’s no good to change the code of the plugin at any update.

    Plugin Author Sutherland Boswell

    (@sutherlandboswell)

    Unfortunately I haven’t had any time to focus on this feature, but I do hope to include it one day.

    The good news is that I do have a solution for you to use in your functions.php file. I have not tested it, but I think it will work:

    function limit_video_thumbnails_to_post_format( $markup, $post_id ) {
    	if ( has_post_format( 'video', $post_id ) ) {
    		$markup = '';
    	}
        return $markup;
    }
    
    add_filter( 'video_thumbnail_markup', 'limit_video_thumbnails_to_post_format', 10, 2 );
    Thread Starter nata-lee

    (@nata-lee)

    Hello!

    Thanks for the filter!!

    But the code has a typo, an exclamation before has_post_format is needed, because we need to set an empty markup for posts which are NOT videos.

    function limit_video_thumbnails_to_post_format( $markup, $post_id ) {
    	if ( !has_post_format( 'video', $post_id ) ) {
    		$markup = '';
    	}
        return $markup;
    }
    
    add_filter( 'video_thumbnail_markup', 'limit_video_thumbnails_to_post_format', 10, 2 );

    Thank you!
    I’m going to test it for a while.

    Plugin Author Sutherland Boswell

    (@sutherlandboswell)

    Oops, glad you were able to figure that out!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘post format filter’ is closed to new replies.