WP CSS Widget Classes

I have been working on a number of client sites recently and there seems to be an every increasing need to use WordPress widgets, and why not as they are a great way of getting content where you need it. However styling them provided tricky as they all have similar classes (although this is flexible to a degree through register_sidebar(). Therefore I have developed the WP CSS Widget Classes plugin.


The plugin provides a select box on each widget that you add to a sidebar. This allows you to choose from the built in classes which are colour based. However you can always customise the classes in the select list by add a simple bit of code to your WordPress theme functions.php file. Maybe in a future release I will add a UI for this but for now code is needed.

The code is open sourced and available to browse, download, fork or submit a pull request from on Github. The repository is linked below:

WP CSS Widget Classes on Github

User Switching from The WordPress Admin Bar

Recently I have been working on a number of multisite installs of WordPress. The largest of these has been for a multisite install that is being used as an Intranet in a corporate environment. To help see the site from other users’ perspective I have been using the excellent User Switching plugin by John Blackbourn. However much of the switching I wanted was from the front end. This post looks at how I solved this problem.

Since WordPress 3.0 (ish) the WordPress admin bar has provided easy access to a lot of the dashboard functions such as writing new posts and pages and moderating comments etc. Along with this came the ability to easily customise the WordPress admin bar, adding your own content to it. With this in mind it seemed the obvious solution was to add User Switching to the admin bar, so that it would be enabled from the front end of the site.

Therefore I went about building a plugin to do this which you can see below:

[gist id=5007195 bump=1]

Initially I had a problem with the plugin in that I could not get the wpnonce working for the switch to user links. However excellent support from the plugin author helped me solve this problems in minutes. Thanks to John for a speedy and precise answer to the query.

The plugin works great, but if you do not have User Switching installed, the plugin checks for this and then does nothing. What I really need is for the plugin to not activate if the User Switching plugin is not installed. If anyone could help me out with this I would be very grateful.