Hide sidebar on specific posts/categories
Hello, I want to hide sidebar and make the content full width on some posts... I have already set in betheme option sidebar to left to all posts.
How can I hide the sidebar on some posts in order to make the content full width.
I used this function:
add_filter( 'sidebars_widgets', 'disable_sidebar_widgets' );
function disable_sidebar_widgets( $sidebars_widgets ) {
if (is_single(array(3449)))
$sidebars_widgets = array( false );
return $sidebars_widgets;
}
and this css lines
function disable_sidebar_widgets( $sidebars_widgets ) {
if (is_single(array(3449)))
$sidebars_widgets = array( false );
return $sidebars_widgets;
}
and this css lines
.postid-3491 .postid-3493 .postid-3495.sidebar.sidebar-1.four.columns, .ora-articol {display: none !important;}
.postid-3491 .postid-3493 .postid-3495.sections_group {width: 100% !important;}
.postid-3491 .postid-3493 .postid-3495.sections_group {width: 100% !important;}
The problem is that the sidebar is gone for all pages, not only for this ids... please give me a solution.
Have a nice day
Comments
I need to say tht I don’t want to set post meta from theme option, I have a lot of posts saw the only solution is to make something on specific posts..
If not: http://prntscr.com/lnhkpn
You have to insert for every post where you don't want to have a sidebar.
Or disable it on all posts in the blog.
Cheers.