All that code will do is return an empty primary sidebar – plus you’ll get errors if you are not hooking to the right selector.
No need to complicate matters – just leave sidebar.php as it is and add the following CSS code to your child theme’s style.css
.site:before,#secondary{width:0;display:none;}.ie8 .site:before,.ie8 #secondary{width:0px;display:none;}.featured-content{padding-left:40px;}.site-content,.site-main .widecolumn{margin-left:40px;}.ie8 .site-content,.ie8 .site-main .widecolumn{margin-left:40px;}
@media screen and (min-width: 1008px) {.search-box-wrapper{padding-left:368px;}}@media screen and (min-width: 1080px) {.search-box-wrapper,.featured-content{padding-left:368px;}}
Then add the following code to your child theme’s functions.php
function ridizain_remove_widgets(){
// Remove Primary sidebar from widget area.
unregister_sidebar( 'sidebar-1' );
}
add_action( 'widgets_init', 'ridizain_remove_widgets', 11 );
The CSS will remove the sidebar from the site and the function will remove the widget area from the Admin side.
Let me know how it goes.
Zulf