Daniel McClure

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

Posted by & filed under Wordpress.

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 ;)

Share the Love
Get Free Updates

Post comment as twitter logo facebook logo
Sort: Newest | Oldest
mosquitohawk 5 pts

This works great thanks.  I notice though you're missing the closing curly bracket for the function.  Very helpful, thanks!

danielmcclure 5 pts moderator

 mosquitohawk Thanks for pointing that out. Not sure how it slipped through but the post has now been updated!

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!

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

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