admin-plugins author calendar category facebook post rss search twitter

TIDY REPO

The best and most reliable WordPress plugins

Better Text Widget

Plugin Author: Aaron D. Campbell

Jay Hoffmann

February 17, 2014

Widgets

Better Text Widget adds a small improvement to text widgets in WordPress. It adds a unique class name to each instance of a text widget in your sidebar based on the title of the widget to allow for easier CSS customization.

What’s It Do?

Basically, any text widgets that you add to a WordPress sidebar will have a new class name attached to it. The class name is based off the title of the Widget itself. So, if you’re title is “Widget Title” then the class for that widget will be “widget-title.” The idea is that text widgets might be used for a variety of different things, and it may be necessary to attach unique styling to each. With Better Text Widget you can use the new class name to restructure the widget’s styling without effecting any of the others.

How’s It Work?

When installed, Better Text Widget will start working right away. Any text widget you have will inherit a class based on the class name. If your widget does not have a title, then no class name will be assigned. If a widget is titled “My Widget” then the HTML markup will look like this:

<aside id="text-3" class="widget widget_text my-widget">
  // Widget Content
</aside>

That means you can use the “my-widget” class to style the individual widget however you want. Let’s say we want to make the title green and add a large top margin above the actual content. We would use this CSS.

.my_widget .widget-title {
    color: green;
}

.my_widget .textwidget {
    margin-top: 3em;
}

Since we are using the “my-widget” class, other text widgets on the page will not be effected. If you are a front-end developer, this can be very, very useful and I’m sure there are dozens of manipulations that can be done that are beyond the scope of this tutorial.

Costs, Caveats, Etc.

Better Text Widget is free and has been updated a few times to weave it into the WordPress API more efficiently. With no settings and only a single piece of functionality though, it is not update much. If you’re having a problem with it, please visit the support forums.

Resources

Download Better Text Widget Now!

Did you like this post?

About this Plugin
Get the latest

Signup for our newsletter to get plugin tips, and see what's coming down the pipe.

Plugin Categories