Real-time collaboration using TowTruck
TwoTruck is a new service developped by Mozilla which allow you to collaborate in real-time.
For details about how it works, check this page: https://towtruck.mozillalabs.com/
It can be useful if you have to deal remotely with customers.
The following code add a button to the Top Admin Bar and launch the script.
To make it works, add this snippet to your functions.php:
/**
* ADD TOWTRUCK TO THE TOP ADMIN BAR
*/
//Add button in admin top bar:
function add_tow_truck( $admin_bar ) {
$admin_bar->add_menu( array(
'id' => __( 'tow-truck' ),
'title' => 'Get Help',
'href' => '#',
'meta' => array(
'onclick' => 'TowTruck(this); return false;'
)
) );
}
add_action( 'admin_bar_menu', 'add_tow_truck' );
//Load script when admin bar is showing:
function load_tow_truck_script() {
if ( is_admin_bar_showing() )
wp_enqueue_script( 'TowTruck', 'https://towtruck.mozillalabs.com/towtruck.js' );
}
add_action( 'wp_enqueue_scripts', 'load_tow_truck_script' );
add_action( 'admin_enqueue_scripts', 'load_tow_truck_script' );
Written by Etienne Tremel
Related protips
1 Response
Thanks for sharing this.
It was super easy to implement and works quite well.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Real-time
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#