Copy To Clipborad Button For Code Snippets – Copy The Code

Copy The Code is a tiny WordPress plugin that automatically adds a ‘Copy’ button to code snippets wrapped in the <pre> tag.

Clicking the ‘Copy’ button will copy the code snippets to the clipboard and then paste them to anywhere you wish.

No Flash required.

How to use it:

1. Download the plugin to your computer.

2. Goto the Add Plugins page.

3. Upload the zip and install the plugin.

4. Activate the plugin and done.

5. Wrap your code snippets into the <pre> tag.

Copy the Code Pre Tag

6. If you want to change the default selector for example using the <code> tag instead of <pre>, just copy and paster the following snippets to the function.php of your theme.

add_filter( 'copy_the_code_localize_vars', 'my_slug_copy_the_code_localize_vars' );
function my_slug_copy_the_code_localize_vars( $defaults )
{
  // `single class is added to the `` tag for the single page, post etc.
  $defaults['selector'] = 'body.single code';
  return $defaults; 
}

Preview:

Copy To Clipborad Button For Code Snippets-min

Download WordPress Plugin:

You can download this free WordPress plugin using the download button below. Unless otherwise stated, the WordPress plugin is available under GNU General Public License.

Author: Mahesh M. Waghmare
Homepage: https://github.com/maheshwaghmare/copy-the-code/

Don’t forget to share this WordPress plugin and also check out other awesome plugins on our site.

Rate This Plugin
Sending
User Review
2.67 (6 votes)