Any way to use a custom Parameter for vimeo embed without using an iframe?

You should add a filter on oembed provider to allow customs parameters:

add_filter( 'oembed_fetch_url', 'my_oembed_fetch_url', 10, 3 );

function my_oembed_fetch_url( $provider, $url, $args ) {
    // You can find the list of defaults providers in WP_oEmbed::__construct()
    if ( strpos( $provider, 'vimeo.com' ) !== false) {
        // Check the full list of args here: https://developer.vimeo.com/apis/oembed
        if ( isset( $args['autoplay'] ) ) {
            $provider = add_query_arg( 'autoplay', absint( $args['autoplay'] ), $provider );
        }
        if ( isset( $args['color'] ) && preg_match( '/^[a-f0-9]{6}$/i', $args['color'] ) ) {
            $provider = add_query_arg( 'color', $args['color'], $provider );
        }
        if ( isset( $args['portrait'] ) ) {
            $provider = add_query_arg( 'portrait', absint( $args['portrait'] ), $provider );
        }
        if ( isset( $args['title'] ) ) {
            $provider = add_query_arg( 'title', absint( $args['title'] ), $provider );
        }
        if ( isset( $args['byline'] ) ) {
            $provider = add_query_arg( 'byline', absint( $args['byline'] ), $provider );
        }
    }

    return $provider;
}

then, in your template:

<?php wp_oembed_get('http://vimeo.com/44633289', array('color' => '7AB800')); ?>

or via a shortcode in post’s content:

[vimeo 44633289 color=7AB800]

and you can do the same for youtube and all others oembed providers (if your my_oembed_fetch_url allow it)

Leave a Comment

error code: 523