Categories
WordPress

Wisps, a WordPress Plugin

With Wisps, you can have code snippets similar to Gist, Pastebin, or similar code sharing sites. Using the built-in WordPress code editor, you can write snippets to post and share.

Last year I had a need for an editable JSON file that was retrievable via HTTP. Of course there’s a million ways that I could do this, but the easiest I thought of would be to have it inside of WordPress, since all of the people that needed access to edit the file already had edit access to a specific site. So I built a plugin.

Doing this inside WordPress already brings a lot of benefits with little to no effort:

  1. User Management
  2. Revision History
  3. oEmbed Support
  4. Permalinks
  5. Syntax Highlighting Code Editor
  6. Self-Hosted Data

Possibly more benefits as well, depending on the setup, such as caching.

I’ve tweaked the plugin some, and I’m almost ready to submit it to the WordPress.org Plugin Repository. I just need to do the hard part of figuring out artwork. Ugh.

Introducing Wisps:

Wisps are embeddable and sharable code snippets for WordPress.

With Wisps, you can have code snippets similar to Gist, Pastebin, or similar code sharing sites. Using the built-in WordPress code editor, you can write snippets to post and share. This has the benefit of WordPress revisions, auto-drafts, etc to keep a record of how code changes.

Wisps can be downloaded by appending /download/ to the permalink, or viewed raw by adding /view/ or /raw/. There is full oEmbed support so you can just paste in a link to a wisp in the editor and it will be fully embedded.

PrismJS is used for syntax highlighting for oEmbeds.

You can add Wisp support to your theme either by modifying the custom post type page-wisp.php template, which will continue to display Wisps in the loop securely, or you can use add_theme_support( 'wisps' ) to tell the plugin to not automatically escape the output. You can then do what you like, such as potentially adding frontend support for syntax highlighting.

Here’s what the oEmbed data looks like:

(Yeah, I totally stole the design from Gists, because I’m not talented 😬)

View the example Wisp

View it raw

Download it

Currently available on GitHub

Hopefully one day available on the WordPress.org Plugin Repository 🙂

If you give it a try and have any suggestions, or issues drop me a line here or on GitHub!

Leave a Reply