Advanced Responsive Video Embedder Shortcode

Below, you’ll find a detailed guide on how to add the Advanced Responsive Video Embedder Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Advanced Responsive Video Embedder Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Advanced Responsive Video Embedder Plugin and the shortcodes it provides:

Plugin Icon
Advanced Responsive Video Embedder (Rumble, YouTube, Vimeo, HTML5 Video …)

"Advanced Responsive Video Embedder is a versatile plugin that enables seamless embedding of videos from Rumble, YouTube, Vimeo, and HTML5 into your WordPress site, ensuring optimal responsiveness."

★★★★✩ (163) Active Installs: 40000+ Tested with: 6.3.2 PHP Version: 5.6
Included Shortcodes:
  • [arve]

Advanced Responsive Video Embedder [arve] Shortcode

The Advanced Responsive Video Embedder (ARVE) shortcode is used to embed responsive videos into your WordPress site. This shortcode takes an array of arguments, checks for errors, and removes empty elements. It then applies filters to override the shortcode and its arguments. If a URL is provided, it removes and then re-adds the ’embed_oembed_html’ filter and attempts to extract oEmbed data from the provided URL. Finally, it builds and returns a video based on the given arguments.

Shortcode: [arve]

Examples and Usage

Basic example – Embed a video using URL.

[arve url="https://www.youtube.com/watch?v=dQw4w9WgXcQ" /]

Advanced examples

Embed a video using URL and specify the video start time.

[arve url="https://www.youtube.com/watch?v=dQw4w9WgXcQ" start="30" /]

Embed a video using URL, specify the video start time and end time.

[arve url="https://www.youtube.com/watch?v=dQw4w9WgXcQ" start="30" end="120" /]

Embed a video using URL, specify the video start time, end time and autoplay the video.

[arve url="https://www.youtube.com/watch?v=dQw4w9WgXcQ" start="30" end="120" autoplay="yes" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [arve] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'arve', __NAMESPACE__ . '\shortcode' );

Shortcode PHP function:

function shortcode( $a ) {

	$a                        = (array) $a;
	$a['errors']              = new \WP_Error();
	$a['origin_data']['from'] = 'shortcode';

	foreach ( $a as $k => $v ) {
		if ( '' === $v ) {
			unset( $a[ $k ] );
		}
	}

	$override = apply_filters( 'nextgenthemes/arve/shortcode_override', '', $a, 'not used' );

	if ( '' !== $override ) {
		return $override;
	}

	$a = apply_filters( 'nextgenthemes/arve/shortcode_args', $a );

	if ( ! empty( $a['url'] ) ) {

		remove_filter( 'embed_oembed_html', __NAMESPACE__ . '\filter_embed_oembed_html', OEMBED_HTML_PRIORITY );
		$maybe_arve_html = $GLOBALS['wp_embed']->shortcode( array(), $a['url'] );
		add_filter( 'embed_oembed_html', __NAMESPACE__ . '\filter_embed_oembed_html', OEMBED_HTML_PRIORITY, 4 );

		$oembed_data = extract_oembed_json( $maybe_arve_html, $a['url'], $a );

		if ( $oembed_data ) {
			$a['oembed_data']         = $oembed_data;
			$a['origin_data']['from'] = 'shortcode oembed_data detected';
		}
	}

	return build_video( $a );
}

Code file location:

advanced-responsive-video-embedder/advanced-responsive-video-embedder/php/functions-shortcodes.php

Conclusion

Now that you’ve learned how to embed the Advanced Responsive Video Embedder Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *