How Can I Edit the Widgets?

Written by Bec on November 17, 2008 – 8:30 AM -

One of the neatest features to WordPress is the widget. With a simple click, a drag and drop, you have customized sidebars in no time flat. But what if the widget just doesn’t display correctly for your theme? Where are the darn things and can they be adjusted?

Answer: Yes, if you’re comfortable editing code, you can edit them, and they’re located on the widgets.php file located in the includes folder of WordPress. You can’t edit this from the design or plugin areas, so you’ll have to download it and do your edits on your drive, and then replace the page online when you’re finished. Reminder: COPY the page before you edit and tuck it in another folder just to be sure you have the original in case something goes wrong!

For example, I just had a client who asked for some setup help, and upon activating the Tag Cloud Widget, I saw that the font size and the number of tag words was just too much for the sidebar space alloted via the template theme he was using. Words were crammed in over others, and the font size had words busting out over the blog edges. Here’s where I did a little editing magic to bring things back into proper scale for his blog:

File to manipulate in a program like Dreamweaver or Notepad: wp-includes/widgets.php

Find this entry around line 1372:

Make your changes to:

“smallest” = the size of the smallest font you want
“largest” = the size of the largest font you want
“number” = the amount of tags you want to appear
“orderby” = is how the orders of the tags will be shown

With some careful customizations of your widgets, you can have full control back on how things look on your blog!

Tags: , ,
Posted in Articles & Tutorials, Blog Plugins & Widgets, Design Tips & Tools | 2 Comments »

2 Comments to “How Can I Edit the Widgets?”

  1. Bec Says:

    That is indeed a valid observation, as I did neglect to mention that you should have a folder for any modified files so that you could easily replace them once you’ve performed an upgrade.

    As to overriding the function with the template itself, I have to admit, I’d be clueless on how to approach that solution. Got any examples?

  2. Adult Webmaster Podcast Says:

    This is good information but it may be better to handle these kind of modifications by overriding the function in your theme/template files, instead of modifying the WordPress core. Next time you update WordPress (which happens frequently) you wont have to worry about merging these changes or making them again.

Leave a Comment

You must be logged in to post a comment.