Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to remove default sidebar text when sidebar is unregistered
Tagged: default, remove sidebar, Sidebar, unregister
- This topic has 10 replies, 3 voices, and was last updated 11 years, 4 months ago by asterbird.
-
AuthorPosts
-
February 27, 2013 at 6:29 pm #23208asterbirdMember
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!
February 27, 2013 at 7:20 pm #23214Brad DaltonParticipantFebruary 27, 2013 at 8:18 pm #23222asterbirdMemberFebruary 28, 2013 at 7:12 am #23255Brad DaltonParticipantWhere 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:
.page-id-330 .sidebar { display: none; }
February 28, 2013 at 9:29 am #23280asterbirdMemberI 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...
February 28, 2013 at 9:44 am #23284Brad DaltonParticipantYou can grab the page i.d's using Firebug or in the source code:
.post-id-334 .page-id-330 .page-id-230
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
February 28, 2013 at 10:18 am #23299asterbirdMemberI'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.
February 28, 2013 at 10:35 am #23302asterbirdMemberI 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...
February 28, 2013 at 10:57 am #23305asterbirdMemberOkay, 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!
April 20, 2013 at 12:38 am #36515Jon SmithMemberHi 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' );
`April 30, 2013 at 1:27 pm #38615asterbirdMemberThanks so much! That worked perfectly!!
-
AuthorPosts
- The topic ‘How to remove default sidebar text when sidebar is unregistered’ is closed to new replies.