Help! My WordPress theme uses Widgets and I’m getting a big white space in between widgets. What is this and how can I remove this?
Elizabeth down at Table for Five asked the question above as her blog had some ugly white space in the sidebar and she just couldn’t figure out how to get rid of it. Her page appeared like this:
note the white space marked with the red marker.
Turns out that she is using Widgets on the site and the area below the white space consists of a Text widget. The thing about this widget is that it has no title, so the widget code creates a big white space instead of this. How can this be fixed?
The answer is to update the widget code and enable it to handle blank headers in a more graceful manner. Here’s how to do this:
- Click on your Plugins Menu and choose Edit Plugin.
- Select the Sidebar Widgets plugin for editing
- Search for “function widget_text” and this should take you to the following function:
function widget_text($args, $number = 1) {
extract($args);
$options = get_option('widget_text');
$title = $options[$number]['title'];
if ( empty($title) )
$title = ' ';
- Change the line $title = ‘ ‘; to $title =”; (that’s 2 x single quotes)
- Click Update File to save the plugin
Switch back to viewing your site and you should see that the problem has been fixed.
Please Note: The change above involves direct changes to your widget.php file. Please make sure that you have a backup of your plugin folder before you do this.
Not quite sure what I’ve done wrong, but I end up with
Parse error: syntax error, unexpected T_STRING in /home/chrismer/public_html/wp-content/plugins/widgets/widgets.php on line 834
I tried entering the amendment manually at first, using two ‘
then I tried ” – a single quotation mark
then I tried copying’n’pasting your amendment
call resulted in the error above, assuming it posts again.
Any chance you could let me know where I’ve gone wrong?
scrap that, apologies, feel free to remove both these comments.
Looks like I initially used a double quotation mark, and my subsequent edits weren’t written to the file – when I FTPed in and edit the widgets.php manually, I discovered a double quotation mark ” was still there.
If these comments do stay, a note to other readers… Either carefully type in two ‘ or just copy the master’s suggestion directly, and paste in 🙂
@Chris: Good thing you managed to solve that. I’m going to add a note above to try and make it clearer, and also one warning people to backup their widgets.php file 😉
Why go through all that?!?!?? You can just find out the ID or class for that section’s title and hide it with CSS.
good tips nice blog (checking through all the nofollow blog community).