Code Snippets plugin
Code Snippets is a free WordPress plugin that provides an easy, clean and simple way to add code snippets to your site. It removes the need to add custom snippets to your theme’s functions.php file.
Overview
A snippet is a small chunk of PHP code that you can use to extend the functionality of a WordPress website; in other words, a snippet can be termed as a mini-plugin but with less overheads on your site.
The common (and slightly unproductive) practice is to add snippet code to your active theme’s functions.php file. While this does get the job done, it can be cumbersome to manage in the long run. What happens when you change your active theme? What if you update your active theme? In either case, your snippets will be lost.
Code Snippets changes that by providing a GUI interface that lets you add snippets and run them on your site just as if they were in your theme’s functions.php file.
Snippets can be exported and then imported to another site, either in JSON format (for later importing to a WP site using the Code Snippets plugin itself), or in PHP (for, say, creating your own plugin or theme).
Usage
- 1
-
Once you have installed and activated the Code Snippets plugin, you will notice a new Snippets menu in the admin panel. To add a snippet, head to Snippets > Add New.
- 2
- 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. Essentially, you'd type in the code snippet in the code editor, add a description to help you remember the purpose of the snippet, specify a name/title for the said snippet, and that's it. Optionally, you may specify a priority order for snippet execution and add custom tags to sort snippets.
Code Snippets can be downloaded from WP.org for free, and has been localized into multiple languages. Note that GeoDirectory does not maintain Code Snippets plugin, and for additional support, you might need to contact the plugin's developers.
You can find GeoDirectory-specific code snippets here.