• Resolved holliate

    (@holliate)


    add_filter( 'sidebars_widgets', 'disable_all_widgets' );
    
    function disable_all_widgets( $sidebars_widgets ) {
    
    	if ( is_single() )
    		$sidebars_widgets = array( false );
    
    	return $sidebars_widgets;
    }

    works to remove sidebars from posts, but content width is still restrained to the same parameters as if sidebar was still visible. how do I fix this?

    link to a post from website

    anybody? please?

Viewing 5 replies - 1 through 5 (of 5 total)
  • CrouchingBruin

    (@crouchingbruin)

    You want to add a CSS rule that overrides the existing rule which keeps the content at 580px. Go to Appearance → Customize → Additional CSS and add this rule:

    
    .singular-post .content {
       width: 100%;
    }
    
    Thread Starter holliate

    (@holliate)

    Oh! I love you! Thank you! That works.

    CrouchingBruin

    (@crouchingbruin)

    By the way, in your original post, you mentioned adding some code to remove the sidebar. Did you add it to the theme’s functions.php file? You should be warned that making changes directly to theme files is not recommended. If the theme gets updated because of feature enhancements, bug fixes, or security patches, or if the theme has to be updated because of a change to the WordPress core, then your changes will be lost. The recommended process for making changes to the theme is to create a child theme and add your code to your child theme’s functions.php file. Or, if you find making a child theme too complicated, you could also hide the sidebar using CSS as well, and the CSS in WordPress’ Additional CSS option will (should) always be there regardless of theme updates.

    Thread Starter holliate

    (@holliate)

    Just move the same code over into Additional CSS?

    CrouchingBruin

    (@crouchingbruin)

    No, you can’t mix up PHP code with CSS, and because your site isn’t currently showing a sidebar, I can’t give you the CSS rule to hide it. I guess just keep in mind that if/when you update the theme, the sidebar will probably re-appear, and then you can either post a follow-up message to ask how to hide it, or you can re-edit the functions.php file with your changes to hide it.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Remove sidebar from post, keep content width 100%’ is closed to new replies.