Change page template default to sidebar

Hey there!

More often than not I want to use the page template with the sidebar, especially for pages created by other plugins like Buddypress.

Is there a way to make all pages default to using the sidebar template? Then instead of selecting sidebar it would happen by default, and I would select something like “full width” template.

Awesome theme, loving it. You guys have changed the game.

Thanks!

Hey Simon,

Thanks for getting in touch and welcome to the BB forums! Sorry but I’ve really no experience with Buddypress. However, you can change the default template to have a sidebar by swapping the codes inside the page.php and tpl-sidebar.php. Just be sure to remove the commented out template name part on the new page.php file and put one on the new tpl-sidebar.php file, maybe even change the name to No Sidebar.

This changes the default template to have a sidebar whenever it’s enabled under the Theme Customizer but I can’t say if this default template will be used by Buddypress.

Hope this makes sense.

Ben

Nice one Ben, thanks!

FYI I create a file called page.php in the child theme and added the below code to make every page have a sidebar:

<?php get_header(); ?>

<div class="container">
	<div class="row">
		
		<?php FLTheme::sidebar('left'); ?>

		<div class="fl-content <?php FLTheme::content_class(); ?>">
			<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
				<?php get_template_part('content', 'page'); ?>
			<?php endwhile; endif; ?>
		</div>

		<?php FLTheme::sidebar('right'); ?>

	</div>
</div>

<?php get_footer(); ?>

Hey Simon,

No worries! Yes, that’s the only difference between the two aside from the comments that a template requires. You mentioned about having a No Sidebar/Full Width template hence my swapping suggestion. :slight_smile: Enjoy The Beaver! :slight_smile:

Ben