How to remove default sidebar text when sidebar is unregistered

Community Forums Forums Design Tips and Tricks How to remove default sidebar text when sidebar is unregistered

This topic is: resolved

This topic contains 10 replies, has 3 voices, and was last updated by  asterbird 1 year, 5 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #23208

    asterbird
    Participant
    Post count: 101

    Hello! I’m using AgentPress Listings on a customized AgentPress theme.

    I’m unregistered the primary and secondary sidebars with this code, but now the default text shows up:

    Primary Sidebar Widget Area

    This is the Primary Sidebar Widget Area. You can add content to this area by visiting your Widgets Panel and adding new widgets to this area.

    How do I get ride of this? I’ve researched it, and they say to put an empty text box in the widget. Well, when you unregister, there is not place to put the textbox anymore, and I really don’t want the client to have to mess with this. I just want the primary sidebar gotten rid of altogether, since I have custom sidebars showing.

    Any help is greatly appreciated!

    #23214

    braddalton
    Participant
    Post count: 10182

    This should do it:
    [css]
    .sidebar {
    display: none;
    }
    [/css]


    #23222

    asterbird
    Participant
    Post count: 101

    sorry, the site is here.

    The display none takes away the entire sidebar, even my custom sidebars.

     

     

    #23255

    braddalton
    Participant
    Post count: 10182

    Where do you want to remove it exactly? Which url’s?

    You can grab the class from the source code or use Firebug:

    To remove the sidebar from the url you linked to use this code:
    [code]
    .page-id-330 .sidebar {
    display: none;
    }
    [/code]


    #23280

    asterbird
    Participant
    Post count: 101

    I would like to remove it from the apartments child pages, the properties child pages, and the contact page.

    Firebug shows that it has no special class, only the regular ones like .widget, .widget_text and .textwidget. These classes will affect my custom sidebars.

    Maybe I’m not adding my custom sidebars right. I use the genesis_register_sidebar function and then hook into the sidebar with this code:

    add_action( ‘genesis_before_sidebar_widget_area’, ‘my_custom_sidebar’ );

    function my_custom_sidebar() {

    … my stuff…

    }

    So I want a sidebar, just not the primary sidebar…

    #23284

    braddalton
    Participant
    Post count: 10182

    You can grab the page i.d’s using Firebug or in the source code:
    [css]
    .post-id-334
    .page-id-330
    .page-id-230
    [/css]

    Why not install the Genesis Simple Sidebars plugin?

    What did you do to cause this? Warning: Illegal offset type in isset or empty in /home/sarahmo/public_html/hr/wp-includes/widgets.php on line 580


    #23299

    asterbird
    Participant
    Post count: 101

    I’m not sure how grabbing the page id’s will help, as the empty primary sidebar has no unique classes to grab. Using the following code will also get rid of my custom sidebars:

    .page-id-330 .widget_text { display: none; } or

    .page-id-330 .widget { display: none; }

    The warning was caused by fiddling around in my functions.php file – I fixed it.

    Maybe I should rename the primary sidebar and use it. I’m not sure how to rename it or display it only on a certain page, so that’s why I was trying to get rid of it.

    #23302

    asterbird
    Participant
    Post count: 101

    I thought about using Genesis Simple Sidebars, but that doesn’t take care of the primary sidebar. That only does the legwork for adding new/custom sidebars in the admin. Unless I missed something…

    #23305

    asterbird
    Participant
    Post count: 101

    Okay, I put my custom sidebars outside the #sidebar div, and now I can use display none on the #sidebar div. That works great, except for the ugly code still left in the html. Ah, well, guess I’ll have to go with this.

    Thanks so much for your help, Brad!

    #36515

    Jon Smith
    Participant
    Post count: 1

    Hi There,

    I had a similar requirement on my site. I found the code below on http://gregrickaby.com/2011/02/genesis-code-snippets.html and thought it might help you too.

    Jon

    `
    /** Remove default sidebar */
    remove_action( ‘genesis_sidebar’, ‘genesis_do_sidebar’ );
    `

    #38615

    asterbird
    Participant
    Post count: 101

    Thanks so much! That worked perfectly!!

Viewing 11 posts - 1 through 11 (of 11 total)

The topic ‘How to remove default sidebar text when sidebar is unregistered’ is closed to new replies.