Quickly create and embed individual code snippet posts. Access the snippet post directly, view raw, or show all snippets in an archive list.
Author: | Pat O'Brien (profile at wordpress.org) |
WordPress version required: | 3.9 |
WordPress version tested: | 4.9 |
Plugin version: | 1.2 |
Added to WordPress repository: | 29-10-2015 |
Last updated: | 11-11-2017
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
|
Rating, %: | 80 |
Rated by: | 4 |
Plugin URI: | http://obrienlabs.net |
Total downloads: | 2 753 |
Active installs: | 20+ |
Click to start download
|
Screenshots
Snippets embedded in a post.
List of all snippets in an archive list. The list can be customized to your theme.
The direct snippet post itself. Not embedded.
List of all snippets in wp-admin.
Editing an existing snippet post type.
General settings page for codeSnips.
Editor specific settings for the Ace Editor.
Usage tips to help out.
FAQ
Installation Instructions
Install
Installing codeSnips can be done from inside your WordPress admin panel by going to Plugins > Add New and searching for “codeSnips”.
- You can also manually install it by downloading the plugin from wordpress.org/plugins
- Upload the entire
codesnips
folder to the /wp-content/plugins/
directory
- Activate the plugin through the ‘Plugins’ menu in WordPress
- Customize the plugin from the menu by selecting codeSnips > Settings.
Uninstall
- Deactivate the plugin from the Plugins menu
- Select “codeSnips” from the list and select “Delete”
- This will delete all files from the server and all settings from the WordPress database.
How do I embed a snippet into my post?
It’s easy. Once you’ve created your snippet, you need to know the snippet ID. Easiest way is to go back to the “All Snippets” page in the Admin Dashboard. Then just copy and paste the shortcode that’s next to your post. For example, you would copy [snippet id=5]
to your post, and that’s it!
Can I have private or password protected snippets?
You can! Just set the status of the post when you create your snippet. An important item to understand is that if your snippet is password protected or private, then it will not show when you use the shortcode. The snippet will also not be available in the view raw
mode.
What if I want to hide (or show) the snippet meta bar?
The snippet meta bar is enabled by default. The meta bar contains the filename and the code language. If you want to disable the snippet bar globally, you can do so in the codeSnips Settings page. Likewise, if you want to disable it for just a single snippet embed at a time, you can add meta="false"
to your shortcode. For example, [snippet id="15" meta="false"]
would show the snippet ID 15 with the description but no meta bar.
What if I want to show the snippet description?
The descriptions are disabled by default. To enable them, you must type in a description in the snippet edit page, then check the checkbox for it to display on the single snippet post. To add a description for an embedded post, just add desc="true"
to your shortcode. For example, [snippet id=20 desc="true"]
would show the snippet ID 20 and it’s description if it had one.
How do I change the look of the snippet box?
Just edit the frontend.css file located under CSS folder. You can remove the border, or even change the way the gutter and everything looks (without changing the built-in editor Themes)
How many options are available using the shortcode?
You can see all the documented options under the codeSnips > Settings menu, then select the Usage tab.
Can I help you translate the plugin?
Yes please! As of 1.1 the POT file is available. If you translate it, let me know and I’ll include it in a maintenenace release!
ChangeLog
1.2
- Upgrades to the latest version of Ace Editor
- Fixes the height of the code box
- General code cleanup
1.1.6
- Fixes a bug where the snippet slug was reset to default on deactivate/reactivate.
- Update where all new snippets have the “Show Snippet Description” enabled by default.
1.1.5
- Fixes another small bug found with CPT post update messages.
1.1.4
- Fixed a small bug with the CPT post update messages.
1.1.3
- Added Jetpack Markdown capability in the snippet description. Fixed missing language settings, too.
1.1.2
- Some changes to the plugin’s Settings page structure
1.1.1
- Removed some CSS from admin.css, which was altering items it didn’t need to.
1.1
- Added internationalization options for the text fields. Interested in translating this plugin? Let me know!
1.0.2
- Further updates on how the custom post type sample URL is being displayed on the General Settings page.
1.0.1
- Found a small bug with the custom post type URL being displayed incorrectly on the General Settings page.
1.0