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.
If you see any PHP errors on activating the plugin then the most likely cause is that you are using PHP 4. This plugin requires PHP 5.
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 a page (or post) for which you want one or more sidebar content widgets. The widget entry areas will be found in a sub panel headed “Side Content Widgets”. In each area enter the HTML (including any heading) you wish to appear. The widget content will be saved along with the rest of the page or post.
- 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.
- Note: as of release 0.5 it has its own subpanel on the edit page.
- Note: as of release 0.6 the plugin is compatible with WordPress-MU.
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.
Sign up to our newsletter for great WordPress and Drupal tips.








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!
September 30th, 2008 at 2:39 pm
Hi, great plugin. I am using it with only 2 issues and not sure if you can help. I am displaying a side nav using ul and li tags - my links a href=”" etc etc, are always saving with backslashes =\”/link/”\. Ive used the HTML editor as you suggested. After removing the unnecessary slashes and saving the page again it works. Any idea why this is happening?
Second thing is, any idea how to make the “value” input field bigger as the side content is quite long and hard to edit in the small input box. I suspect this is editing the actual WP page - did you have to do this, or attempt to do this?
Thx
Rob
September 30th, 2008 at 2:50 pm
Rob, thanks for the comment and glad you like the plugin. The slashes
issue is a WP bug, I’m afraid.
Regarding your other question, in a future version I mean to give the plugin its own edit area which should make life easier for anyone dealing with large chunks of HTML.
Edit: From release 0.5 the new edit area has been added and the slashes error is no longer a problem.
September 30th, 2008 at 5:22 pm
Here’s a quick fix for the small boxes problem reported by Rob. Add the following to wp-admin.css:
#postcustomstuff textarea {
height:200px; /* adjust to suit your needs */
}
Edit: with the latest release the plugin has its own panel with larger input areas.
October 4th, 2008 at 1:25 am
I like the ideal of being able to add content. I follow the directions I think but got a weird looking layout on my widget screen after I put html in the same box that I named. Do you have simpler step by step instructions available for this plugin? I would really appreciate it! Thanks,
Dee
October 16th, 2008 at 4:37 am
Hello,
I wonder how can I add content to a widget using th API. I would loike to add the code in my template files. I know how to check if it has widgets or not, but I do not know how to set the content of the widget.
Can you help me?
Thanks in advance,
Will
October 16th, 2008 at 12:54 pm
Hey,
I just want to let everyone know that I got a ultra-fast and very helpful reply via email to my previous question so I want to thanks Alfred for his plugin, his blog and now also for his support. Way to go!
All best,
Will
October 26th, 2008 at 3:21 pm
[...] Side Content [...]
October 26th, 2008 at 3:48 pm
[...] Download Plugin | Side Content Wordpress Plugin page [...]
October 26th, 2008 at 5:10 pm
[...] Side Content [...]
October 26th, 2008 at 8:30 pm
[...] Side Content [...]
October 26th, 2008 at 8:37 pm
[...] Side Content [...]
October 26th, 2008 at 9:55 pm
[...] Side Content [...]
October 26th, 2008 at 11:09 pm
Great except
I can not get the post or page to save more than 1 widget (the last one) the others do not get saved.
is this somehting obvious I am missing.
October 27th, 2008 at 3:30 am
[...] Side Content [...]
October 27th, 2008 at 3:58 pm
Dear Alfred,
I am getting this error code when I try to activate the plug-in, can you help?
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
Thank You.
October 27th, 2008 at 11:03 pm
I was looking forward to this plugin. However, it does not seem compatible with the Multi-User version of WordPress.
http://mu.wordpress.org
When I submit the names of the widgets in the Settings area, it shows me the “try again” screen.
October 28th, 2008 at 3:44 pm
[...] Give your page wings: the WordPress Side Content Plugin | Likemind Web ServicesErmöglicht es, für jeden Beitrag / Seite eines Wordpress-Blogs eigene Widgets festzulegen. Würde z.B. post-abhängige Werbeblöcke ermöglichen. Wird beizeiten getestet. [...]
October 28th, 2008 at 7:14 pm
I would love to use this plugin with my my WP MU. It’s an awesome idea and is very helpful.
But when I try to add my widget lines it says: Are you sure you want to do this? Try again!
Can you please help?
Thank you so so much.
Vida
October 31st, 2008 at 9:34 pm
[...] Side Content [...]
November 1st, 2008 at 8:47 am
[...] Side Content [...]
November 1st, 2008 at 7:49 pm
My side content widgets appear on my Widgets page, but when saving a post the side content doesn’t save, whether entered in the drop down box nor as a custom field. After saving it just disappears and the drop down box has closed and is empty. Any ideas? Thanks!
November 1st, 2008 at 9:28 pm
[...] Side Content [...]
November 3rd, 2008 at 1:53 am
Hi Alfred,
I’m getting the same error when activating in WP v263:
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /var/www/vhosts/example.com/httpdocs/wp-content/plugins/side-content/side-content.php on line 18
Line 18 Code:
private $widgets = array();
Thanks for any help you can provide, and great work with this plugin — It’s a life saver, from one sidebar hardcode-er to another!
November 3rd, 2008 at 11:01 am
Josh, the PHP error is due to you running under PHP4. Please note that PHP4 is not supported.
November 3rd, 2008 at 4:32 pm
[...] Side Content [...]
November 9th, 2008 at 6:25 am
Hi, i really want this plugin to work… but when i go to settings -> side content
and enter the name of the widgets .. on clicking save i get the following error:
“Are you sure you want to do this?
Please try again.”
Even if i try again ..the contents are not getting saved …any suggestions would really help
November 9th, 2008 at 6:31 pm
[...] Side Content Plugin [...]
November 9th, 2008 at 7:56 pm
[...] Side Content Plugin [...]
November 9th, 2008 at 8:00 pm
For Nirav and others using WordPress MU, the latest release includes the necessary magic code required for MU compatibility.
November 9th, 2008 at 11:44 pm
[...] Side Content Plugin [...]
November 10th, 2008 at 1:31 am
[...] Side Content Plugin [...]
November 10th, 2008 at 1:47 am
[...] Side Content Plugin [...]
November 10th, 2008 at 3:42 pm
[...] Side Content Plugin [...]
November 10th, 2008 at 3:47 pm
[...] Side Content Plugin [...]
November 10th, 2008 at 4:24 pm
[...] Side Content Plugin [...]
November 10th, 2008 at 9:26 pm
[...] Side Content Plugin [...]
November 11th, 2008 at 9:30 am
[...] Give your page wings: the WordPress Side Content Plugin | Likemind Web Services (tags: wordpress widgets sidebar plugin) [...]
November 14th, 2008 at 7:24 am
[...] Side Content Plugin [...]