Code Snippets


Code Snippets is an easy, clean and simple way to add code snippets to your site. It removes the need to add custom snippets to your theme theme’s functions.php file.

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 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 just as if they were in your theme’s functions.php file.

Code Snippets provides graphical interface, similar to the Plugins menu, for managing snippets. Snippets can can be activated and deactivated, just like plugins. The snippet editor includes fields for a name, a visual editor-enabled description, tags to allow you to categorize snippets, and a full-featured code editor. 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.

Links

Reviews and Mentions

Recommended by Nathan B. Weller from Elegant Themes as one of his Top Non-Obvious WordPress Plugins on CodeinWP.

Code Snippets was #1 on ManageWP’s Top 10 WordPress Plugins of the Month for September 2012.

It was on ManageWP’s list of Top 100 Free WordPress Plugins of the Year, as well as one of Tom Ewer’s personal top 10 picks.

Reviewed by WPMU Dev: WordPress Code Snippets: Keep them Organized with this Plugin!

If you have a review or mention that I haven’t heard of, please let me know.

11 responses to “Code Snippets”

  1. Shea,

    I’ve installed plugin, use the Snippets on the admin panel. But I can’t find any info how to insert this code snippets in my posts?

    No one screenshoots, no info can’t find.

    Help!

    • Hello Anton,

      My Code Snippets plugin is not for embedding PHP code in posts and pages. Snippets, when activated, run on every page of your site, all the time. They’re essentially mini-plugins. If you need a plugin to embed PHP code in posts and pages, I would recommend a plugin such as Global Content Blocks. There are also many more out there.

      Hope this helps

      • omg what the f**k. I spent this entire morning trying to get “code snippets” to insert a code snippet in my post. Well thank you, finally I know.

  2. Hi Shea,

    This plugin worked great, thanks! I think I could help you translate this plugin into Chinese if you need. I will send you the .po file later.

    Jincheng

    • Hi Jincheng,

      I would be really great if you could provide a Chinese translation. I’m currently working on version 2.0, which will include a few other translations as well. I would love to have a Chinese translation included with this release.

      Thank you very much!

  3. Hi,

    I’ve installed the code-snippet plugin from admin console then whenever I activate the plugin, whole site crashes with error “too many redirections” and becomes unreachable. I had to remove the folder code-snippets under plugins directory. What can be the problem?

    • Where you using any snippets with the plugin? Also, perhaps try out the latest version (2.3.0), which may have fixed this issue.

  4. Hello
    I use Genesis and a Child Theme. First the code snippet worked well. Then I try to close (deactivate) one snippet witch should remove the post info function. And it will not be removed.
    • I reload a new function.php and the snippet is still there.
    • I close the Code Snippet plugin and the snippet is still there.
    Why? Why is it still in my function?
    /Anna

    • Code Snippets doesn’t modify your functions.php file – you need to do that yourself. The only snippets that it manages are the ones you see on the Snippets admin menu

  5. This plugin blocks my access to my “Add Media” while writing a post. Also make sure you have save your new post before you go to “Add Media” as I didn’t and lost everything I had written. I had to deactivate this plugin so that I could access my media library when writing a post.

    • I’ve never come across this issue with the Code Snippets plugin myself. Are you sure that it’s not an error caused by the code in one of your snippets?