• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

Genesis: 3 Ways To Remove The Primary Sidebar From Single Pages

This post shows you 3 ways to remove the primary sidebar widget area from single pages only.

The reason i wrote this post is to answer this forum question:

How do I unregister the default primary sidebar widget on single pages?

You can:

  1. Add CSS code to your child themes style.css file
  2. Add a custom function with conditional tag to your child themes functions.php file
  3. Create a new page.php file using the WordPress Template Hierarchy and add the remove_action for the sidebar.

CSS

Paste the CSS before the start of your Media Queries in your child themes style.css file.

.page-template-default .sidebar-primary {
display: none;
}

Custom Function

Simply copy the PHP code from the view raw link in the Gist and paste it at the end of your child themes functions.php file.

You may need to modify the conditional checks to suit your needs.

Page Template File

  1. Create a new file using a code editor like Notepad++
  2. Copy the PHP code from the view raw link in the Gist
  3. Paste the code into the new file and upload it to your child themes root directory

Please refer to the WordPress Template Hierarchy for more information.

Related Tutorials

  • Add Custom Sidebar & Remove Primary Sidebar

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags