-
-
Save ramiabraham/7002128 to your computer and use it in GitHub Desktop.
Just a plugin to load together.js in WP.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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