• It seems to me that there is no existing way to wrap HTML tags around just the widget content. Does anyone have a suggestion as to how to wrap only the content of a sidebar widget in an HTML tag and not the whole widget?

    Basically, I have this:

    <div class="widget">
    <h3>Widget Title</h3>
    Widget Content
    </div>

    And what I want is this:

    <div class="widget">
    <h3>Widget Title</h3>
    <div class="widget-content">Widget Content</div>
    </div>

    Is this even possible?

    I ask because the widget div has 0 padding. The H3 (title) of the widget has 0 padding. The title looks good but the content looks bad without padding. But I can’t add padding to just the content–I have to add it to the entire widget div. But when I do that it adds padding around the title as well. How can I have padding on just the widget content, without putting it on the entire widget?

Viewing 1 replies (of 1 total)
  • Thread Starter gman243

    (@gman243)

    And yes, I’ve heard of adding the <div class=”widget-content”> opening tag to the ‘after_title’ parameter and then add the </div> closing tag to the ‘after_widget’ parameter. The only issue is if there is not title it ends up generating an extra </div> closing tag and breaks the entire layout.

    Not to be annoying but I think it’s valid of me to point out that this really should be included as a feature of the register_sidebar function–I don’t understand why it wouldn’t be.

Viewing 1 replies (of 1 total)
  • The topic ‘Add Padding to Sidebar Widget Content but Not The Title’ is closed to new replies.