• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Hide sidebars from Category pages

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Hide sidebars from Category pages

This topic is: resolved

Tagged: category, education, sidebars

  • This topic has 7 replies, 3 voices, and was last updated 10 years, 3 months ago by michiganseo.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • June 20, 2013 at 2:47 pm #46929
    wyattwerner
    Member

    I'm using the Education theme, and have it set up to have two sidebars as its default layout. I have a few items in the navigation that lead to category pages, but I don't want those pages to have sidebars.

    How can I hide the sidebar areas on a category page?

    Thanks in adavance!

    http://www.idahodairymens.org/category/letters-opinions/
    June 20, 2013 at 3:06 pm #46933
    Brad Dalton
    Participant

    You can use CSS or PHP code.

    CSS: Use the class for sidebars and the body class for category pages with display: none as the declaration.

    PHP: Would need to write a custom function.


    Tutorials for StudioPress Themes & WooCommerce.

    June 20, 2013 at 3:26 pm #46937
    wyattwerner
    Member

    I was hung up on the idea that I didn't have a page ID, but I can just use the category id. Bleh! Thanks!

    I did this:

    .category-11 .sidebar {
    display:none;
    }

    I also made the content area wider to fill in the space left by the hidden sidebar:

    .category-11 #content {
    width: 875px;
    }
    June 27, 2013 at 8:46 am #48024
    michiganseo
    Member

    wyattwerner,

    On your home page, I noticed that both the blog posts are removed AND the PRIMARY SIDEBAR. How did you remove both of these from the homepage. I would like to do something similar.

    Thanks!

    June 27, 2013 at 9:42 am #48032
    wyattwerner
    Member

    @michiganseo:

    I added two lines of code to the bottom of functions.php (not my magic; I found it somewhere in the forum):

    remove_action( 'genesis_loop', 'genesis_do_loop' );
    remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
    
    genesis();

    Leave out the final "genesis" line; that's just to show where I put it in the file.

    June 27, 2013 at 11:01 am #48065
    michiganseo
    Member

    @wyattwerner:

    Thank you so much for your response. That code removed the primary sidebar from all pages. I'm just looking to remove the primary sidebar from the home page -- similar to what you seem to do here: http://www.idahodairymens.org. Please let me know if you have a thought on that... Thanks again so much for your help!

    June 27, 2013 at 1:45 pm #48088
    wyattwerner
    Member

    Aha! Sorry.

    Don't do this in functions.php, but rather in home.php. That'll affect only the home page.

    June 27, 2013 at 2:08 pm #48093
    michiganseo
    Member

    That makes sense... Adding those 2 lines of code to home.php eliminated the posts from displaying; however, the primary sidebar is still visible... strange... thanks for your efforts!

  • Author
    Posts
Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble