Hacks
WordPress: Conditional Widget Display on Sidebar
Before when WordPress themes do not support widgets, we used to control lists on our sidebars via PHP modifications. It’s not a task for everyone, and widgets were created.
But the thing is, once you add a widget to your sidebar, it will automatically display itself on your homepage and your single pages as well.
Today I learned that you can control it, not via PHP, but on your style.css.
Every widget on your sidebar has a unique id. So you can control them easily on your style.css.
Ex.
li#tag_cloud { display:none; }
This will hide the Tags widget from the sidebar, but the thing is it won’t be shown to any page either. So you need to know what division it is included to. In my case, I use #home class for my main division when on homepage and #page class when on single pages.
So on my style.css, I have:
#page li#tag_cloud { display:none; }
This hides the Tags widget when on single pages.
You just have to make sure that you use different divisions for home and single pages. But if you have a better workaround for displaying widgets conditionally, let me know. I’d like to learn from you too.
Better Comments Manager made even better :)
UPDATE: Actual file attached. After downloading, extract the file and override the existing better-comments-manager.php file in your plugin folder. Enjoy
![]()
I use Better Comments Manager to easily manage comments from users on my blogs. But I found it quite inconvenient because I always have to go to “Comments” menu and then do another click to access the function so I modified the plugin to make the function accessible from the Dashboard page.
I planned to post the plugin but weeks ago, Jaypee announced the latest version of the plugin which enables the user to access the function straight from the Admin Panel. I thought my plan to blog about it was totally ruined but I noticed that there’s something more I can add to make the plugin better.
Currently, the plugin adds a menu to access the function and the menu lies inline with other top level menus. IMO, the menu is placed not perfectly well so I make it a submenu on the Dashboard page. Here’s how it looks now. For me, this is much a better look. I can’t attach the file yet but if you want, I can send it to you.