Skip to content

Instantly share code, notes, and snippets.

@marczobec
Last active April 24, 2016 16:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save marczobec/f6c319b85b8cd24ea6ca to your computer and use it in GitHub Desktop.
Save marczobec/f6c319b85b8cd24ea6ca to your computer and use it in GitHub Desktop.
Extension for Kirby's kirbytext. Embed vine posts in your content with a tag. For more information about Kirby visit http://getkirby.com
<?php
kirbytext::$tags['vine'] = array(
'attr' => array(
'size'
),
'html' => function($tag) {
$vineURL = $tag->attr('vine');
$size = $tag->attr('size', '300');
return '<iframe src="' . $vineURL . '/' . 'embed/simple" width="' . $size . '" height="' . $size . '" frameborder="0" class="vine-embed"></iframe><script async src="https://platform.vine.co/static/scripts/embed.js"></script>';
}
);
?>
@marczobec
Copy link
Author

Usage:

Insert 'vine.php' at:
your_kirby_folder/site/tags/vine.php

Embed your vine posts with:
(vine: https://vine.co/v/O3m90adUjdb)

You can also specify the size of the embed (defaults to 300, Vine's options are 600px, 480px and 300px):
(vine: https://vine.co/v/O3m90adUjdb size: 600)

@marczobec
Copy link
Author

Update:

  • added async attribute to script (thanks to @plfstr)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment