WordPress.org

Ready to get started?Download WordPress

Forums

Simple Page Sidebars
[resolved] hiding sidebars (18 posts)

  1. globalreporter
    Member
    Posted 2 years ago #

    Hi,
    Is it possoble to hide sidebars for sepcific posts, categories and pages?
    Thanks!

    http://wordpress.org/extend/plugins/simple-page-sidebars/

  2. turiyamoore
    Member
    Posted 2 years ago #

    I'm in 2010 theme and this is not working. any thoughts?

  3. Blazer Six
    Member
    Plugin Author

    Posted 2 years ago #

    globalreporter, that's beyond the scope of this plugin.

    turiyamoore, it will work fine in Twenty Ten, but you'll need to make some changes to integrate per the installation instructions. And please start a new topic in the future so anyone that might be experiencing a similar issue can find the answer.

    Around line 20 of sidebar.php, you should see this:

    if ( ! dynamic_sidebar( 'primary-widget-area' ) ) : ?>

    Replace that with this:

    if ( function_exists( 'simple_sidebar' ) ) :
    	simple_sidebar( 'primary-widget-area' );
    elseif ( ! dynamic_sidebar( 'primary-widget-area' ) ) : ?>

    Then drop this snippet in your functions.php file so that the HTML will match your theme:

    add_filter('simpsid_widget_area_defaults', 'twentyten_widget_area_defaults');
    function twentyten_widget_area_defaults($defaults) {
    	$defaults['before_widget'] = '<li id="%1$s" class="widget %2$s">';
    	$defaults['after_widget'] = '</li>';
    	$defaults['before_title'] = '<h3 class="widget-title">';
    	$defaults['after_title'] = '</h3>';
    	return $defaults;
    }

    That should take care of everything, however, you'll need to be aware that if you ever upgrade or switch your theme, you'll need to make the same changes again.

  4. turiyamoore
    Member
    Posted 2 years ago #

    Blazer Six Thank You for your reply.
    I believe I followed your instructions but still see no effect on the site. In the dashboard everything is as it should be. It appears to work there, but not display.

    One concern I have is I'm not sure I know exactly how to "drop in" that HTML snippet above. Here is a copy of what I have in functions.php. any thoughts you might have I'm really interested to hear! thanks!

    [Code moderated as per the Forum Rules. Please use the pastebin]

  5. Blazer Six
    Member
    Plugin Author

    Posted 2 years ago #

    That should work fine for functions.php. Did you make the change in sidebar.php as well? That's the most important one.

    If you haven't assigned a custom sidebar to a page or added any widgets to that custom sidebar, your default sidebar will continue to display, so make sure you've done that as well.

  6. turiyamoore
    Member
    Posted 2 years ago #

    Hi, I did make the change in sidebar.php and I have the alternate sidebar showing in my "All Pages" view. It lists the custom sidebar in a sidebar column. The side bar has a menu widget stuck in it too. I did that from the widgets page. It all looks perfect in the dashboard, but the site has the default sidebar, the new sidebar is nowhere to be seen.

    any ideas? I'm all ears.
    thanks for your help.

  7. Blazer Six
    Member
    Plugin Author

    Posted 2 years ago #

    Without looking at the code, I'm all out of ideas, but if you'd like to contact me through our site and let me take a look, I'd be happy to do a little troubleshooting.

    http://www.blazersix.com/contact/

  8. turiyamoore
    Member
    Posted 2 years ago #

    Here are the full functions.php, and sidebar.php after suggested mods.

    http://pastebin.com/u/turiyamoore

    is there anything else you need? like header.php?

    thanks again

  9. Blazer Six
    Member
    Plugin Author

    Posted 2 years ago #

    I copied that code to my setup and everything works perfectly. Do you have any other plugins that affect your sidebars?

  10. turiyamoore
    Member
    Posted 2 years ago #

    Hi, no, not that I know of.

    list:
    WordPress Importer
    WP Google Fonts
    WP Online Store
    WP Photo Album Plus
    WP Simple Paypal Shopping cart

    several these are not activated

    ?

  11. turiyamoore
    Member
    Posted 2 years ago #

    Blazer Six,
    it's the blog page that is set to shoe an alternate sidebar

    http://joyiswithinyou-org.anandagrassvalley.org/

  12. Blazer Six
    Member
    Plugin Author

    Posted 2 years ago #

    That solves it! Your blog page isn't really a "page" in the same sense that other pages are since it lists multiple posts and is a little beyond the simple problem this plugin was meant to solve. I'll see if I can't come up with a solution to include in a future release, though.

    But for now, in your particular case, you can modify the code in sidebar.php again to include a new check and call the sidebar you setup for your blog section:

    if ( is_home() ) :
    		dynamic_sidebar( 'Blog Sidebar' );
    elseif ( function_exists( 'simple_sidebar' ) ) :
            simple_sidebar( 'primary-widget-area' );
    elseif ( ! dynamic_sidebar( 'primary-widget-area' ) ) : ?>

    Just change the "Blog Sidebar" string to whatever you named your blog sidebar.

  13. turiyamoore
    Member
    Posted 2 years ago #

    Blazer Six,
    Thank You. It finally works. I really appreciate the help!

    Peace,
    turiya

  14. turiyamoore
    Member
    Posted 2 years ago #

    Blazer Six,

    Ok, so is this all because of the way I built this site?

    The page we worked on is fine, but that is a start page to get into the blog. All I want is a blog location (page) that can be browsed into different categories, and individual posts and maintain the custom sidebar. Now, if you click off the blog page into a category the default sidebar is there, as well as if you go to individual posts from the category page. I don't know if this is a plugin issue, or if there is a better way to structure my nav.
    samples:
    http://joyiswithinyou-org.anandagrassvalley.org/blog/category/spirituality/

    http://joyiswithinyou-org.anandagrassvalley.org/blog/intuition-and-its-development/

    any thoughts? does this make sense? I'm a total noob but I'm not giving up!

  15. Blazer Six
    Member
    Plugin Author

    Posted 2 years ago #

    We'll get you taken care of. Knowing your end goal now, we're going about this backwards and this plugin will do exactly what you want.

    Your default sidebar (Primary Widget Area) should contain the Custom Menu widget that you currently have in your blog sidebar so that it applies everywhere. Then you would assign your pages (Home, About, Meditation Tips, etc.) a custom sidebar to override the default--you can assign the same sidebar to all of them so you only have to update the widgets in one place.

    You'll then want to remove the custom sidebar you added to the blog page and change the code in sidebar.php back to the originally suggested snippet:

    if ( function_exists( 'simple_sidebar' ) ) :
    	simple_sidebar( 'primary-widget-area' );
    elseif ( ! dynamic_sidebar( 'primary-widget-area' ) ) : ?>

    Hope that makes sense and gets you what you want.

  16. turiyamoore
    Member
    Posted 2 years ago #

    Hey thanks!
    I'll try this later today and let you know.
    I do appreciate your help. Thanks a ton.

    I saw your website. It's very awesome. Clear, but also shows some humility. I bet your really good at building sites to fit your clients needs.

    http://www.blazersix.com/

    turiya

  17. turiyamoore
    Member
    Posted 2 years ago #

    Blazer Six,

    Hey thanks a billion. It's all good now. I do appreciate all the help.

    Now I have a lot of work to do!

    Peace,
    turiya

  18. Blazer Six
    Member
    Plugin Author

    Posted 2 years ago #

    Glad to hear it's working now, thanks for the compliments and good luck!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic