-
Notifications
You must be signed in to change notification settings - Fork 4
Embeds
Radoslav Georgiev edited this page Sep 3, 2016
·
1 revision
The Rila\Embed
class is a simple wrapper to the wp_oembed_get
function.
To create a new embed, use the rila_embed( $url )
function:
$embed = rila_embed( 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' );
The URL parameter should be from a website, which is among the WordPress-supported embed providers.
Within templates, you can simply output the embed. It will be converted to the needed string.
{{ post.video }}
You can use the width( $width )
and height( $height )
methods to manipulate the dimensions of the embed.
Please keep in mind, that only pixels heights are supported here. However, if you set a width, you can leave the height to be auto-adjusted. This way, WordPress will load the height automatically.
{{ post.video.width( 1280 ).height( 720 ) }}
{{ post.video.width( 800 ) }}
When using data mapping, you can use the embed
shortcut to quickly map an URL to an embed.
Next article: Request Variables
- Overview
- The basics
- Data types
- Extending the framework
- Helpers
- Others/Advanced
- Performance