Astra_After_Setup_Theme::responsive_oembed_wrapper( string $html, string $url, array $attr, bool $core_yt_block = false )

Adds a responsive embed wrapper around oEmbed content


Description


Parameters

$html

(string) (Required) The oEmbed markup.

$url

(string) (Required) The URL being embedded.

$attr

(array) (Required) An array of attributes.

$core_yt_block

(bool) (Optional) Whether the oEmbed is being rendered by the core YouTube block.

Default value: false


Return

(string) Updated embed markup.


Source

File: inc/class-astra-after-setup-theme.php

		public function responsive_oembed_wrapper( $html, $url, $attr ) {

			$add_astra_oembed_wrapper = apply_filters( 'astra_responsive_oembed_wrapper_enable', true );

			$allowed_providers = apply_filters(
				'astra_allowed_fullwidth_oembed_providers',
				array(
					'vimeo.com',
					'youtube.com',
					'youtu.be',
					'wistia.com',
					'wistia.net',
				)
			);

			if ( astra_strposa( $url, $allowed_providers ) ) {
				if ( $add_astra_oembed_wrapper ) {
					$html = ( '' !== $html ) ? '<div class="ast-oembed-container">' . $html . '</div>' : '';
				}
			}

			return $html;
		}


User Contributed Notes

You must log in before being able to contribute a note or feedback.