[Plugin: Copy in clipboard] Now compatible with WP 3.3
-
I modifed the below code to be compatible with 3.3. It was throwing an error about calling wp_deregister_script incorrectly.
<?php /* Plugin Name: Copy in clipboard Description: Small plugin that copy text into clipboard (onClick) from title tag using zeroclipboard. Author: CoYoTe Version: 0.8 Author URI: https://www.ivanherceg.in.rs */ add_action('wp_enqueue_scripts', 'my_scripts_method'); function my_scripts_method() { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js'); wp_enqueue_script( 'jquery' ); add_action('wp_head', 'copyinclipboard', 15); wp_register_script( 'zeroclipboard', WP_PLUGIN_URL . '/copy-in-clipboard/zeroclipboard.js' ); wp_enqueue_script( 'zeroclipboard' ); } function copyinclipboard() { echo '<script type="text/javaScript"> ZeroClipboard.setMoviePath( \''. WP_PLUGIN_URL . '/copy-in-clipboard/zeroclipboard.swf\' ); jQuery(document).ready(function() { jQuery(\'.copy\').mouseover(function() { var txt = jQuery(this).attr("title"); var url = jQuery(this).attr("href"); clip = new ZeroClipboard.Client(); clip.setHandCursor(true); clip.setText(txt); clip.glue(this); clip.addEventListener(\'complete\', function(client, text) { alert("Copied to clipboard! Paste where you want it!" ); if (url!=undefined){ //this is for window.location=url; //<a href links } //to do it }); }); }); </script>'; } ?>
https://www.ads-software.com/extend/plugins/copy-in-clipboard/
- The topic ‘[Plugin: Copy in clipboard] Now compatible with WP 3.3’ is closed to new replies.