Justin Tadlock

My Snippets: WordPress Plugin

One of my favorite plugins has always been Widget Logic, which allows you to display/hide widgets based on context. The biggest limitation of that plugin to me is that I had to go to my Widgets screen in my WordPress admin every time I wanted to add a new widget for a single post or page.

What I wanted was something that allowed me to control widget content from the post editor, so I wouldn’t have to worry about setting my widgets. This gave me the idea for the My Snippets plugin.

What this plugin does is add an extra meta box on the post editor that allows you to input custom content. This content is then displayed using the Snippet widget in any widget area you choose.

How the plugin works

First, you’d add the Snippet widget to the widget area of your choosing. You’ll need that to display your custom snippets.

When writing a post (or page), you’ll have an extra meta box labeled Snippet Post Settings. In this box, you can add text, HTML, and shortcodes.

Here’s an example of adding a video snippet:

Snippet post settings

Here’s the output of the snippet, which will only be displayed on the singular view of the post/page I added it to:

Output of the Snippet widget

Don’t be fooled by the example though. You can add pretty much anything in your snippet meta box, so feel free to go wild.

Download the plugin

Before using the plugin, please take a moment to read through the readme.html file included with the plugin download.

Please don’t use my contact page or the comments section below to ask support questions. Use my support forums at Theme Hybrid, which is where I handle all support questions for my WordPress projects.