Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Makes WordPress' PressThis use vimeo short code instead of <object>/<embed> tags.
Add this to the WordPress theme's function.php file.
Addresses the Vimeo question from StackExchange here:
function greatjakes_admin_print_footer_scripts() {
if ($_SERVER['PHP_SELF']=='/wp-admin/press-this.php') {
<script type="text/javascript">
var intervalId;
var embedCode;
function monitorEmbedCode() {
embedCode = jQuery("#embed-code").val();
if (embedCode!=null) {
var matches = embedCode.match(/clip_id=([0-9]+)&/g);
var output = '';
var clipId = 0;
for (var i=0; i<matches.length; i+=2 ) {
clipId = parseInt(matches[i].replace(/(.+=)([0-9]+)(&)/,'$2'));
output += '[vimeo clip_id="' + clipId + '" width="400" height="225"]\\n';
intervalId = window.setInterval(monitorEmbedCode,100);
echo $script;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.