• Skip to primary navigation
  • Skip to main content
Daniel McClure

Daniel McClure

Entrepreneurship, Marketing, Technology, Travel & Lifestyle

  • About
  • Credentials
  • The Blog of Daniel McClure
  • Social
  • Code
  • Contact
  • GitHub
  • Instagram
  • LinkedIn
  • Twitter

How To Remove The Sidebars From Your Custom Post Types in Thesis

You are here: Home » WordPress » How To Remove The Sidebars From Your Custom Post Types in Thesis

Last Updated: July 29, 2010 4 Comments

With the recent release of WordPress 3.0 I’ve been creating some truly unique sites utilising the Thesis Theme in co-ordination with the latest features. Whilst custom post types and taxonomies in Thesis have been well documented elsewhere; one thing that caught me at the last hurdle was the ability to remove sidebars from custom posts whilst leaving them active for standard posts.

After brainstorming different methods and scouring blog and forum posts I finally pieced together a solution that worked. As I didn’t see it mentioned anywhere else, I figured that I would share just in case anyone else finds themselves in a similar situation.

function remove_custom_post_sidebars() {
if( get_post_type() == 'custom_post_name' ) {
?>
<style>
#sidebars { display: none; }
#content  { width:100%; }
</style>
<?php
}
add_filter('thesis_hook_before_html', 'remove_custom_post_sidebars');

Simply copy and paste the above into your custom_functions.php file and then edit the bit that says 'custom_post_name' to whatever your actual custom post type is called. Pretty simple once you know how 😉

Filed Under: WordPress Tagged With: #Custom Post Types, #Remove Sidebars, #Thesis, #Thesis Customisation, #Thesis Hacks, #WordPress 3.0

About Daniel McClure

Daniel McClure is a Marketing Technologist and Blockchain Advocate that has worked with large and small businesses around the globe.

Reader Interactions

Comments

  1. Lorene Mascorro says

    November 3, 2010 at 5:54 pm

    Excellent content, just what I had been trying to find.

  2. Sudipto says

    February 14, 2011 at 11:56 am

    Hi Daniel,
    Thanks for share the code. Can you also share the code for the share bar on the top of the post below the headline.

    Thanks in advance

  3. Daniel McClure says

    February 14, 2011 at 12:54 pm

    Hey Sudipto!

    The code for the social media bar is powered by the custom skin I sell at: http://marketingskins.com

    As it is a premium skin I generally don’t just give out huge chunks of the code but as a one off I’m happy to share it for you and have made a direct copy of that specific code within my skin and attached it in an email to you. You may need to edit the CSS slightly to make it work for your site but the bulk is there.

    I hope that helps!

  4. Ricky says

    May 28, 2015 at 2:38 pm

    Why not just do it with CSS instead of going through the functions.php? Custom post type names are put as a class on the body tag:

    .custompost #sidebar{
    display: none;
    }

    .custompost #content{
    width: 100%
    }

Leave a Reply

Your email address will not be published. Required fields are marked *

You can encrypt your comment so that only Daniel McClure can read it.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Daniel McClure

Work With Me

Get in touch if you’re interested in working together on your next project.

Contact Me

Creative Commons Licence

Copyright © 2023 Daniel McClure

All opinions shared through this site are that of their respective author and are not necessarily representative of the views of past/present clients, affiliate partners or businesses.
Some links include affiliate tracking for which I may earn a commission. See the Full Disclaimer Page for more information.