Give your page wings: the WordPress Side Content Plugin
Friday, July 4th, 2008I wrote this plugin to provide similar functionality to the Drupal Side Content module. It makes it easy to have unique sidebar content on any page. Yes, it gives your page wings - or its own widgets, anyway.
You can see it in action on our starter site package page. The three blocks in the righthand sidebar belong to this page and only appear on it. (Our custom theme uses the API functions that come with the plugin to detect the widgets are there and show them in an extra wide sidebar.)
Here’s how to use it:
- Install and activate the plugin in the normal way.
- On the settings page for Side Content, enter the names for your widgets, one per line. (These will also be the names of your custom fields). Save your changes.
- On the Design->Widgets page, you’ll now see your widgets listed and you’ll be able to position them as you like in your sidebar(s).
- Edit any page and add custom fields of the same names as your widgets. In each case, enter the HTML you want to appear as the value for the field.
- Tip: use the HTML editor for the page to create content for a field, then (in HTML mode) cut and paste it into the custom field value area.
- Note: it now works with both pages and blog posts.
Although the plugin does not require any theme changes to be made, it does provide a useful API function that can be used in templates to adjust page layout if required. To call it, code as follows:
if(function_exists('the_side_content')) {
if(the_side_content()->has_widgets()) {
// template adjustments for side content widgets
}
// alternatively, you can test for a particular widget by name
if(the_side_content()->has_widgets('mywidget')) {
// template adjustments for side content widget 'mywidget'
}
}
Note that this plugin requires PHP5 and has only been tested on WordPress 2.5 and 2.6.








July 9th, 2008 at 2:47 pm
hi. Thanks for plugin
perfect.
Regards
July 16th, 2008 at 7:59 pm
[...] Side Content [...]
July 16th, 2008 at 9:31 pm
[...] Side Content [...]
July 16th, 2008 at 10:06 pm
[...] Side Content [...]
July 16th, 2008 at 10:16 pm
[...] Side Content [...]
July 16th, 2008 at 11:56 pm
Sounds brilliant!
Thank you! No more messing about with multiple sidebars!
July 17th, 2008 at 9:15 am
Thanks! Feel free to rate the plugin on wordpress.org: http://wordpress.org/extend/plugins/side-content/
July 18th, 2008 at 2:44 am
I’m going to install this tonight. Just what I was hoping WordPress would do themselves in an update. Great work.
July 18th, 2008 at 4:31 am
[...] - WordPress Side Content Plugin “I wrote this plugin to provide similar functionality to the Drupal Side Content module. It [...]
July 18th, 2008 at 3:28 pm
[...] Side Content [...]
July 19th, 2008 at 4:10 pm
very nice plugin indeed, hope it will include the posts too a day !
I just have had a little problem with the doublequote (”) as they were escaped in the custom field when saved (\”). I used single ones (’) instead and it did work properly
July 19th, 2008 at 4:21 pm
Olivier - I wonder how that happens. I suspect I’m missing one of wordpress’s magical calls that copes with all the different combinations of server variable set ups.
The change to include posts is easy, so I’ll probably add it as an option in the next release.
July 23rd, 2008 at 6:19 am
[...] Side Content [...]
July 25th, 2008 at 10:58 am
This is a great plugin
July 25th, 2008 at 9:43 pm
[...] Side Content [...]
July 31st, 2008 at 12:38 pm
Love the concept but afaird I just dont get it. I desparately want to have different widgets in the side bar of each page of my site.
I followed the first steps and can see the
“Side content widget: Stock Quote Sidebar” on the design, widgets page.
But I dont get where to go from here? Everything I “add” would still appear on all pages?
I’m not sure where exactly to enter the code (or what exactly is the code)
Thanks for you help.
July 31st, 2008 at 1:15 pm
Ryan, so far you’ve created an empty widget. You can position it on the design widgets page, but nothing will actually appear until you give it some content.
The way you give it content is as follows: edit a page or post then scroll down the page until you see the custom fields section. Click on it to open it.
Ignore the pulldown on the left for now. In the key box enter the name of your widget EXACTLY as on the configuration page; in the value box enter the HTML you want for the widget content. Press ‘add’. (If there are quotes in the HTML you may find they’ve got \ characters in front - this is a wp 2.6 bug. In that case re-edit the html and press update for the field and all will be well.)
Now save the page or post, and when you view it you should see the side content widget you defined, only on that page. Repeat for each post or page as required.
One day I hope to have time to spend making the plugin a little easier to use, but don’t hold your breath!
August 11th, 2008 at 11:22 am
Looks like a great plugin - just what I am looking for, except I get an error…
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /mnt/local/home/directory/example.com/wordpress/wp-content/plugins/side-content/side-content.php on line 18
August 11th, 2008 at 3:05 pm
Thanks for your help Alfred. I’ve upgraded from PHP 4.4 to 5.2 and the plugin is now working.
Many thanks!