1. Home
  2. Knowledge Base
  3. Tasty Recipes
  4. Troubleshooting Tasty Recipes
  5. How do I get rid of the large space above my video?

How do I get rid of the large space above my video?

We've had a few customers report that they noticed a large space in their recipe card above their video. The problem here is likely a video library that's included in your theme or another plugin. To resolve this, try adding the following code snippet to your theme functions.php  file:

/**
 * Include 'fitvidsignore' class on responsive video iframes.
 */
add_filter( 'tasty_recipes_recipe_template_vars', function( $template_vars ){
    if ( false !== stripos( $template_vars['recipe_video_embed'], 'tasty-recipe-responsive-iframe-container' ) ) {
        // First try to inject the class into the existing classes.
        $template_vars['recipe_video_embed'] = preg_replace( '#(<iframe[^>]+class=")([^"]+)#', '$1fitvidsignore $2', $template_vars['recipe_video_embed'], -1, $count );
        // If no replacements were found, then the <iframe> needs a class.
        if ( ! $count ) {
            $template_vars['recipe_video_embed'] = str_replace( '<iframe ', '<iframe class="fitvidsignore" ', $template_vars['recipe_video_embed'] );
        }
    }
    return $template_vars;
});

If you would prefer to keep using your their theme's solution for responsive videos, instead of ours, you can try adding the following code snippet to your theme functions.php file:

/**
 * Remove Tasty Recipes responsive video iframes.
 */
add_action( 'tasty_recipes_enable_responsive_iframes', '__return_false' );
Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support