Skip to content

Instantly share code, notes, and snippets.

Created October 16, 2013 03:12
Show Gist options
  • Save anonymous/7002125 to your computer and use it in GitHub Desktop.
Save anonymous/7002125 to your computer and use it in GitHub Desktop.
Simple TogetherJS for WordPress
<?php
/*
Plugin Name: TogetherJS for WordPress
Plugin URI: http://www.rami.nu
Description: Integrates TogetherJS with WordPress
Version: 0.1
Author: ramiabraham
Author URI: http://rami.nu
License: GPL 2.0
*/
if ( ! is_admin() ) {
function get_togetherjs_scripts() {
wp_register_script( 'togetherjs', 'https://togetherjs.com/togetherjs-min.js' );
wp_enqueue_script( 'togetherjs', 'https://togetherjs.com/togetherjs-min.js' );
}
add_action('wp_enqueue_scripts','get_togetherjs_scripts');
} // admin check
if ( ! is_admin() ) {
function togetherjs_button_shortcode() {
return '<button onclick="TogetherJS(this); return false;">Collaborate!</button>';
}
} // admin check
add_shortcode( 'together', 'togetherjs_button_shortcode' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment