Use pre-existing base template for taxonomy archive and custom post type

Hey @joneslloyd - a couple of ideas:

First, you could step back and do conditional login in your base.php file to check if the current request is for your CPT or taxonomy and load the correct wrapper template if true.

Second, the SageWrapping class (which returns the appropriate wrapper) applies a filter prior to returning the wrapper template. I haven’t tried it, but it looks like you could hook into that.

From wrapper.php:

public function __toString() {
  $this->templates = apply_filters('sage/wrap_' . $this->slug, $this->templates);
  return locate_template($this->templates);
}

So maybe something like (untested):

function hub_taxonomy_wrapper($templates) {
  if (is_tax('hub_topic')) {
    array_unshift($templates, 'base-template-hub.php');
  }
  return $templates;
}
add_filter('sage/wrap_base', __NAMESPACE__ . '\\hub_taxonomy_wrapper');