WordPress.org

Ready to get started?Download WordPress

Forums

No Widget, but Sidebar won't go away (5 posts)

  1. dtlay
    Member
    Posted 3 years ago #

    I've had this issue through multiple versions and multiple themes. It has happened on the left and the right sidebar, so it has to be a simple setting somewhere, right?

    If I have no widget active in the sidebar, it doesn't go away. Instead, it displays widgets that aren't active. For example, right now my right sidebar is showing Recent Posts, Blogroll (from my Links list) and Meta. But none of these are active, and they don't show on my Widgets page. If I activate a widget in the right sidebar, the other items go away.

    I have 2 active widgets on the left sidebar. If I deactivate or move them, three others show up. Categories, Posts by month, and then some sample widget text.

    The site, if it helps, is LeanHRBlog.com.

    Appreciate any help I could get. I'm trying to avoid poking around in the code, so I'm hoping it's an easy fix.

  2. Alok Tiwari
    Member
    Posted 3 years ago #

    Check sidebar.php
    Your coder had called them if you are not using any widget.

  3. David Gwyer
    Member
    Posted 3 years ago #

    As stated above, the 'default' widgets are shown if none are manually added by yourself. And if you remove them, the defaults will re-appear.

    I'm not sure what you are trying to do exactly. Remove a sidebar permanently, or only when no widgets are actively added by yourself?

    If so you will almost certainly need to edit your sidebar.php file and do a little customization.

  4. dtlay
    Member
    Posted 3 years ago #

    Thanks for the notes.

    @dgwyer, I'd prefer to hide that sidebar if no active widgets are in there.

    Any hint that could be shared on what to change in the code would be welcomed.

  5. David Gwyer
    Member
    Posted 3 years ago #

    Basically you need to wrap the output code in your sidebar so that if no widgets are defined (added by you) then no sidebar div's get rendered.

    A useful function for doing this is is_active_sidebar(), you can read more about this here:

    http://codex.wordpress.org/Function_Reference/is_active_sidebar

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.