Skip to content

Instantly share code, notes, and snippets.

@ramiabraham
Forked from anonymous/togetherjs.php
Last active December 25, 2015 15:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramiabraham/7002128 to your computer and use it in GitHub Desktop.
Save ramiabraham/7002128 to your computer and use it in GitHub Desktop.
Just a plugin to load together.js in WP.
<?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
*
* The idea is that you drop in the [together] shortcode anywhere you'd like live training to occur.
* When users click the button, The (this) initiates the TogetherJS library, and sets it all up.
*I mean, damn. I love Mozilla.
*
*/
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');
function togetherjs_button_shortcode() {
return '<button onclick="TogetherJS(this); return false;">Collaborate!</button>';
}
add_shortcode( 'together', 'togetherjs_button_shortcode' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment