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.

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

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

19 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!

Leave a Reply