- Contributors: bungeshea
- Donate link: http://cs.bungeshea.com/donate/
- Tags: snippets, code, php, network, multisite
- Requires at least: 3.3
- Tested up to: 3.4.2
- Stable tag: 1.5
- License: GPLv3 or later
- License URI: http://www.gnu.org/copyleft/gpl.html
An easy, clean and simple way to add code snippets to your site.
Code Snippets is an easy, clean and simple way to add code snippets to your site. No need to edit to your theme's functions.php file again!
A snippet is a small chunk of PHP code that you can use to extend the functionality of a WordPress-powered website; essentially a mini-plugin with a lot less load on your site. Most snippet-hosting sites tell you to add snippet code to your active theme's functions.php file, which can get rather long and messy after a while. Code Snippets changes that by providing a GUI interface for adding snippets and actually running them on your site as if they were in your theme's functions.php file.
You can use a graphical interface similar to the Plugins menu to manage, activate, deactivate, edit and delete your snippets. Easily organise your snippets by adding add a name and description using the visual editor. Code Snippets includes built-in syntax highlighting and other features to help you write your code. Snippets can be exported for transfer to another side, either in XML for later importing by the Code Snippets plugin, or in PHP for creating your own plugin or theme.
Although Code Snippets is designed to be easy-to-use and its interface looks, feels and acts as if it was a native part of WordPress, each screen includes a help tab, just in case you get stuck.
Further information, documentation and updates are available on the plugin homepage.
If you have any feedback, issues or suggestions for improvements please leave a topic in the Support Forum and if you like the plugin please give it a perfect rating at WordPress.org
- Log into your WordPress admin
- Click Plugins
- Click Add New
- Search for Code Snippets
- Click Install Now under "Code Snippets"
- Activate the plugin
- Download the plugin
- Extract the contents of the zip file
- Upload the contents of the zip file to the
wp-content/plugins/folder of your WordPress installation - Activate the Code Snippets plugin from 'Plugins' page.
'Network Activating' Code Snippets through the Network Dashboard will enable a special interface for running snippets across the entire network.
Further documentation available on the plugin website.
No, just copy all the content inside those tags.
Yes. Just add it but do not activate it yet.
The CodeMirror source-code editor will add line numbers, syntax highlighting, search, tabulate and other cool features to the code editor.
No, the snippets are added to the WordPress database so are independent of the theme and unaffected by WordPress upgrades.
Yes, when you delete Code Snippets using the 'Plugins' menu in WordPress it will clean up the database table and a few other bits of data. Be careful not to remove Code Snippets using the Plugins menu unless you want this to happen.
Yes! You can individually export a single snippet using the link below the snippet name on the 'Manage Snippets' page or bulk export multiple snippets using the 'Bulk Actions' feature. Snippets can later be imported using the 'Import Snippets' page by uploading the export file.
Yes. Click the checkboxes next to the snippets you want to export, and then choose 'Export to PHP' from the Bulk Actions menu and click Apply. The generated PHP file will contain the exported snippets' code, as well as their name and description in comments.
You can run snippets across an entire multisite network by 'Network Activating' Code Snippets through the Network Dashboard.
That's great! Let me know by starting (or adding to) a topic in the Support Forums.
That's fantastic! Join me on GitHub, and also be sure to check out the development page on the project website.
- Updated CodeMirror to version 2.33
- Updated the 'Manage Snippets' page to use the WP_List_Table class
- Added 'Screen Options' tab to 'Manage Snippets' page
- Added search capability to 'Manage Snippets' page
- Added views to easily filter activated, deactivated and recently activated snippets
- Added ID column to 'Manage Snippets' page
- Added sortable name and ID column on 'Manage Snippets' page (#)
- Added custom capabilities
- Improved API
- Added 'Export to PHP' feature (#)
- Lengthened snippet name field to 64 characters (#)
- Added i18n
- Added interface to Network Dashboard
- Updated uninstall to support multisite
- Replaced EditArea with CodeMirror
- Small improvements
- Fixed a bug with version 1.3.1
- Changed plugin website URI
- Cleaned up some code
- Added export option to 'Manage Snippets' page
- Added 'Import Snippets' page
- Minor improvements
- Added code highlighting
- Removed 'Uninstall Plugin' page
- Data will now be cleaned up when plugin is deleted through WordPress admin
- Fixed a permissions bug with
DISALLOW_FILE_EDITbeing set to true (#) - Fixed a bug with the page title reading 'Add New Snippet' on the 'Edit Snippets' page
- Fixed a bug not allowing the plugin to be Network Activated (#)
- Stable version released.
Plugin updates will be posted on the plugin's homepage (RSS).
- Snippets are stored in the
wp_snippetstable in the WordPress database (the table name may differ depending on what your table prefix is set to). - Code Snippets will automatically clean up its data when deleted through the WordPress dashboard.
You can also contribute to the code at GitHub.




