Helper::data_attributes( array $attributes, bool $echo = false )

Output video parameters as data-* attributes.


Returns a string of data attributes that can be used on HTML elements to output the embedding options that will be used by the embedding script to display the video.



(Required) The attributes array.


(Optional) Output the result (true).

Default value: false


(string) The resulting attributes string.


File: includes/libs/helper.class.php

	public static function data_attributes( $attributes, $echo = false ){
		$result = [];
		// these variables are not needed by js and will be skipped
		$exclude = [ 'video_position', 'aspect_override' ];
		// loop attributes
		foreach( $attributes as $key=>$value ){
			// skip values from $exclude
			if( in_array( $key, $exclude ) ){
			$result[] = sprintf( 'data-%s="%s"', $key, $value );
		if( $echo ){
			echo implode(' ', $result);
			return implode(' ', $result);

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!