PHP code example of getolympus / olympus-dionysos-field-oembed
1. Go to this page and download the library: Download getolympus/olympus-dionysos-field-oembed library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
getolympus / olympus-dionysos-field-oembed example snippets
return \GetOlympus\Dionysos\Field\Oembed::build('my_oembed_field_id', [
'title' => 'Never gonna give you up!',
'default' => [
'url' => 'https://www.youtube.com/watch?v=Xxbd5keKhPU',
'height' => 1000,
'width' => 916,
'html' => '<iframe title="Popopooooo" width="916" height="515" src="https://www.youtube.com/embed/Xxbd5keKhPU?feature=oembed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>',
],
'description' => 'You\'ve been Rick rolled!',
/**
* Texts definition
* @see the `Texts definition` section below
*/
't_addblock_label' => 'Enter URL here.',
't_removeblock_label' => 'Clear',
]);
// Get embed from Database
$embed = get_option('my_oembed_field_id', []);
// Check if embed is empty and display it
if (!empty($embed)) {
echo stripcslashes($embed['html']);
}