Skip to content

Instantly share code, notes, and snippets.

View crimann's full-sized avatar

Claudio Rimann crimann

View GitHub Profile
@mawiswiss
mawiswiss / Oembed.php
Last active May 6, 2022 18:36
WordPress oEmbed handler to integrate video and audio players from SRG (including SRF, RSI, RTS and RTR)
wp_embed_register_handler('srg', '#https?:\/\/(?:www\.|player\.)?(srf|rsi|rts|rtr)\.ch\/.+(detail|video|audio).((?:.{8}-.{4}-.{4}-.{4}-.{12})|\d*)(?:.startTime=(\d*)|.*)#i', 'srgEmbedHandler');
function srgEmbedHandler($matches, $attr, $url, $rawattr)
{
return sprintf(
'<iframe width="560" height="315" src="https://%1$s.ch/play/embed?urn=urn:%1$s:%2$s:%3$s%4$s" allowfullscreen allow="encrypted-media"></iframe>',
esc_attr($matches[1]),
esc_attr($matches[2]) === 'audio' ? 'audio' : 'video',
esc_attr($matches[3]),
array_key_exists(4, $matches) ? esc_attr('&startTime=' . $matches[4]) : '',
@Zodiac1978
Zodiac1978 / sample.html
Last active August 17, 2022 07:11
Gutenberg sample content based on https://artisanthemes.io/sample-content-blocks-gutenberg/ but with working placeholders (WIP)
<!-- wp:paragraph {"align":"center","backgroundColor":"very-light-gray","fontSize":"small"} -->
<p class="has-text-align-center has-very-light-gray-background-color has-background has-small-font-size"><p style="color:#000000;text-align:center" class="has-background has-small-font-size has-very-light-gray-background-color">Gutenberg Sample Content.<br>Put together with ❤️ by <a href="https://artisanthemes.io/">Artisan Themes</a> and me.</p></p>
<!-- /wp:paragraph -->
<!-- wp:heading {"level":1} -->
<h1>This is a heading (H1)</h1>
<!-- /wp:heading -->
<!-- wp:heading -->
<h2>This is a heading (H2)</h2>