• Howdy!

    So I’m trying to get a new theme in place for my user that plays right with the Block editor (that I’m still massaging him into using properly).

    Right now we use the Fluid Video Embeds plugin but I was hoping to take advantage of the

    add_theme_support( 'responsive-embeds' );

    for the Video block. This adds a bunch of stuff around the iFrame of a YouTube video including all these classes on the figure element:

    <figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio">

    The problem is none of those styles are loaded. I found many of them in /wp-includes/blocks/embed/style.css and /wp-includes/css/dist/block-library/style.css but neither file is loaded. So I tried adding

    add_theme_support( 'wp-block-styles' );

    but none of those styles came in and I don’t feel like digging through the <head> to see what changed if anything.

    How do you get these styles? Is there a way for them to be attached by standard oEmbed functionality like in the Classic Editor and Classic Paragraph Block?

    Thanks!
    Chris

Viewing 2 replies - 1 through 2 (of 2 total)
  • @clubside I did some testing on some themes on my local environment, and from what I can tell the embed stylesheets should be coming in automatically once you use responsive-embeds. It may be something specific to the way your theme is set up – as a test, maybe you could switch to a default theme such as Twenty Twenty and work backwards and see if there’s something set up in those themes that implement the CSS.

    From my testing, I removed all the CSS from Twenty Twenty One and the responsive embeds still worked. The only thing I noticed that made a difference (and broke the responsiveness) is when I removed body_class() from the following section in my header.php `
    <body <?php body_class(); ?>>`.

    Maybe try verifying that class is there and see if it makes a difference.

    Thread Starter Chris Rowley

    (@clubside)

    Thanks @bengreeley I will give that a try and report back. I’m unfortunately swamped with other issues and I’m not even sure I want those styles at the moment since I’d likely override them. My theme is dead simple, header is just wp_head() and then some extra stylesheets for fonts and such. I assumed the appropriate stylesheets would come as part of wp_head(). As I said the actual classes are being written to the objects, but those classes aren’t being loaded.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Relevant Styles Not Loaded with add_theme_support( ‘responsive-embeds’ )’ is closed to new replies.