Cannot call 'sidebar-primary' unless get_sidebar() is called from base.php

I’m altering the structure of templates and base.php.
I’m doing this to adapt markup to my design.

base.php has this snippet for the sidebar:

<?php if (Setup\display_sidebar()) : ?>
          <aside class="sidebar">
            <?php include Wrapper\sidebar_path(); ?>
          </aside><!-- /.sidebar -->
        <?php endif; ?>
  <?php endif; ?>

If I pull this out of base and into another template (say, single.php) then no sidebar shows.

If replace this snippet with the following call, then I get the fallback wordpress sidebar.php.:

<?php get_sidebar('primary-sidebar') ?>

What could I be doing wrong?

My guess would be not defining the name spaces in your single.php:


Have you read the docs on hiding and showing the sidebar with conditional tags? Or do you have smoother reason it needs to not be in base.php? If you want the sidebar to show up on single.php then why not just hide it on all pages with:

in lib.php/setup.php


and then display it on your single.php with this:

add_filter('sage/display_sidebar', __NAMESPACE__ . '\\sage_sidebar_on_special_page');

function sage_sidebar_on_special_page($sidebar) {
  if (is_page('special-page')) {
    return true;
  return $sidebar;