Solved! Hiding the Sidebar in the blog posts as well as the blog page in Moesia


I figured something out, so I thought I would share.

You know how in Customize > Blog Options, there are options for having no sidebar for the blog page? Apparently there is an additional checkbox in the Astrid theme that lets you hide the sidebar in the single blog posts as well. I wanted that ability, so I hardwired the options to hide the sidebar for the blog page to also hide the sidebar for the blog posts (I still want the sidebar for the other pages). Here’s how you do it:

Select Appearance > Editor
In the Moesia theme, open Single Post (single.php) for editing.

Near the top, replace

	<div id="primary" class="content-area; ?>">
		<main id="main" class="site-main" role="main">


	<?php $blog_layout = get_theme_mod('blog_layout', 'small-images'); ?>

	<?php if ( ($blog_layout == 'masonry') || ($blog_layout == 'fullwidth') ) {
		$layout = 'fullwidth';
	} else {
		$layout = '';
	} ?>

	<div id="primary" class="content-area <?php echo $layout; ?>">
		<main id="main" class="site-main" role="main">

Near the bottom, replace

<?php get_sidebar(); ?>


        <?php if ( $layout == ''  ) {

Save and enjoy!

Hello @sharchen,

Thank you for sharing this!

By the way, it’s better to override modified .php files in a child theme in order to avoid losing modifications after theme update.

Also there is WooSidebars plugin that can do this kind of things.

Kind Regards, Roman.

Thanks Roman, that’s helpful to know! I’m still a relative newbie to WordPress and haven’t yet figured out child themes. I’ll jump on that and WooSideBars.


You are welcome Jon! :slight_smile:

Kind Regards, Roman.