Helper::embed_by_video_id( string $video_id, array $args = array(), bool $echo = true )

Create the embed code based on given parameters


Parameters

$video_id

(Required) The Vimeo video ID.

$args

(Optional) An array of arguments used when embedding.

Default value: array()

$echo

(Optional) Output the embed code (true) or not (false).

Default value: true


Return

(string)


Source

File: includes/libs/helper.class.php

	public static function embed_by_video_id( $video_id, $args = [], $echo = true ){
		$default = [
			'title' => 1,
			'byline' => 1,
			'portrait' => 1,
			'dnt' => 1
		];

		$args = wp_parse_args(
			$args,
			$default
		);

		$embed = sprintf(
			'<iframe src="%s" width="100%%" height="100%%" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe>',
			sprintf(
				'https://player.vimeo.com/video/%s?%s',
				urlencode( $video_id ),
				http_build_query( $args )
			)
		);

		if( $echo ){
			echo $embed;
		}

		return $embed;
	}

Start your video site now!

Manage and coordinate your Vimeo channels, albums or videos with your WordPress website. Perfect fit for membership, portfolio, online courses or any type of video collection.

Get Vimeotheque PRO!