Give your page wings: the WordPress Side Content Plugin

Friday, July 4th, 2008

I 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.)

Download the plugin.

Here’s how to use it:

  1. Install and activate the plugin in the normal way.
  2. 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.
  3. 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).
  4. 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.
  5. 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.
  6. Note: it now works with both pages and blog posts.
  7. Note: as of release 0.5 it has its own subpanel on the edit page.
  8. 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.

Download the plugin.

Share this post: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Technorati
  • del.icio.us
  • StumbleUpon
  • Facebook
  • Sphinn
  • TwitThis

Sign up to our newsletter for great WordPress and Drupal tips.

57 Responses to “Give your page wings: the WordPress Side Content Plugin”

  1. baron Says:

    hi. Thanks for plugin

    perfect.

    Regards

  2. Weblog Tools Collection » Blog Archive » WordPress Plugin Releases for 07/16 Says:

    [...] Side Content [...]

  3. Wp Wordpress » Blog Archive » Weblog Tools Collection: WordPress Plugin Releases for 07/16 Says:

    [...] Side Content [...]

  4. WordPress Plugin Releases for 07/16 | BlogBroker24-7 Says:

    [...] Side Content [...]

  5. WordPress Plugin Releases for 07/16 | Wordpress Blog NL Says:

    [...] Side Content [...]

  6. Flick Says:

    Sounds brilliant! :D Thank you! No more messing about with multiple sidebars!

  7. Alfred Armstrong Says:

    Thanks! Feel free to rate the plugin on wordpress.org: http://wordpress.org/extend/plugins/side-content/

  8. Dan Levy Says:

    I’m going to install this tonight. Just what I was hoping WordPress would do themselves in an update. Great work.

  9. Links for 18-07-2008 | Velcro City Tourist Board Says:

    [...] - WordPress Side Content Plugin “I wrote this plugin to provide similar functionality to the Drupal Side Content module. It [...]

  10. blog.rotracker.net » Blog Archive » WordPress Plugin Releases for 07/16 Says:

    [...] Side Content [...]

  11. olivier Says:

    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

  12. Alfred Armstrong Says:

    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.

  13. Softonix.com » Blog Archive » WordPress Plugin Releases for 07/16 Says:

    [...] Side Content [...]

  14. Philix Says:

    This is a great plugin

  15. WordPress Plugin Releases for 07/16 Says:

    [...] Side Content [...]

  16. ryan Says:

    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.

  17. Alfred Armstrong Says:

    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!

  18. Jake Says:

    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

  19. Jake Says:

    Thanks for your help Alfred. I’ve upgraded from PHP 4.4 to 5.2 and the plugin is now working.

    Many thanks!

  20. Rob Says:

    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

  21. Alfred Armstrong Says:

    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.

  22. Alfred Armstrong Says:

    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.

  23. dee Says:

    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

  24. Will Castillo Says:

    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

  25. Will Castillo Says:

    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

  26. WordPress Plugin Releases for 10/26 | Weblog Tools Collection Says:

    [...] Side Content [...]

  27. Side Content Wordpress Plugin | DA! DA! Wordpress Says:

    [...] Download Plugin | Side Content Wordpress Plugin page [...]

  28. WordPress Plugin Releases for 10/26 | Wordpress Blog NL Says:

    [...] Side Content [...]

  29. Weblog Tools Collection: WordPress Plugin Releases for 10/26 | KaosKoxp Oyun Portali Says:

    [...] Side Content [...]

  30. Weblog Tools Collection: WordPress Plugin Releases for 10/26 | Aslifmbiz Blog Says:

    [...] Side Content [...]

  31. Weblog Tools Collection: WordPress Plugin Releases for 10/26 | PR & Tech Says:

    [...] Side Content [...]

  32. sean Says:

    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.

  33. WordPress Plugin Releases for 10/26 | BlogBroker24-7 Says:

    [...] Side Content [...]

  34. Gary Says:

    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.

  35. Niraj Says:

    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.

  36. links for 2008-10-25 through 2008-10-28 | aloha WEBLOG Says:

    [...] 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. [...]

  37. Vida Says:

    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

  38. WordPress Plugin Releases for 10/26 · Softonix.com Says:

    [...] Side Content [...]

  39. WordPress Plugin Releases for 10/26 | Free Blogs Says:

    [...] Side Content [...]

  40. Tim Hall Says:

    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!

  41. Weblog Tools Collection: WordPress Plugin Releases for 10/26 | Aslifm Blogu Says:

    [...] Side Content [...]

  42. Josh Says:

    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! :-)

  43. Alfred Armstrong Says:

    Josh, the PHP error is due to you running under PHP4. Please note that PHP4 is not supported.

  44. WordPress Plugin Releases for 10/26 | PATRONIT.NET Says:

    [...] Side Content [...]

  45. Nirav Says:

    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

  46. WordPress Plugin Releases for 11/09 | Weblog Tools Collection Says:

    [...] Side Content Plugin [...]

  47. WordPress Plugin Releases for 11/09 | Wordpress Blog NL Says:

    [...] Side Content Plugin [...]

  48. Alfred Armstrong Says:

    For Nirav and others using WordPress MU, the latest release includes the necessary magic code required for MU compatibility.

  49. WordPress плагины за 09/11/2008 | Всё для WordPress (ВордПресс). Модули, шаблоны (скины) для Wordpress. Says:

    [...] Side Content Plugin [...]

  50. WordPress Plugin Releases for 11/09 | BlogBroker24-7 Says:

    [...] Side Content Plugin [...]

  51. Weblog Tools Collection: WordPress Plugin Releases for 11/09 | Aslifm Blogu Says:

    [...] Side Content Plugin [...]

  52. WordPress Plugin Releases for 11/09 | PATRON DIGITAL.COM Says:

    [...] Side Content Plugin [...]

  53. WordPress Plugin Releases for 11/09 | PATRONIT.NET Says:

    [...] Side Content Plugin [...]

  54. Weblog Tools Collection: WordPress Plugin Releases for 11/09 | PR & Tech Says:

    [...] Side Content Plugin [...]

  55. Weblog Tools Collection: WordPress Plugin Releases for 11/09 | KaosKoxp Oyun Portali Says:

    [...] Side Content Plugin [...]

  56. leg med nye medier. Eller noget. Says:

    [...] Give your page wings: the WordPress Side Content Plugin | Likemind Web Services (tags: wordpress widgets sidebar plugin) [...]

  57. WordPress Plugin Releases for 11/09 Says:

    [...] Side Content Plugin [...]

Leave a Reply