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

462public static function embed_by_video_id( $video_id, $args = [], $echo = true ){
463    $default = [
464        'title' => 1,
465        'byline' => 1,
466        'portrait' => 1,
467        'dnt' => 1
468    ];
469 
470    $args = wp_parse_args(
471        $args,
472        $default
473    );
474 
475    $embed = sprintf(
476        '<iframe src="%s" width="100%%" height="100%%" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe>',
477        sprintf(
478            'https://player.vimeo.com/video/%s?%s',
479            urlencode( $video_id ),
480            http_build_query( $args )
481        )
482    );
483 
484    if( $echo ){
485        echo $embed;
486    }
487 
488    return $embed;
489}

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!