Custom base.php for custom post type does not work as in docs

I have a custom post type ‘member’ and custom archive-member.php, single-member.php, content-member.php and content-single-member.php files.

I am trying to create a new base wrapper to change the layout for single-member.php (switch the sidebar to the left, main column to the right).

When I paste the code stated in the docs into lib/extras.php I get these errors:

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘Roots\Sage\Wrappersage_wrap_base_cpts’ not found or invalid function name in /home/vagrant/Code/REDACTED/wp-includes/class-wp-hook.php on line 298

Warning: include(): Filename cannot be empty in /home/vagrant/Code/REDACTED/wp-includes/template-loader.php on line 74

Warning: include(): Failed opening ‘’ for inclusion (include_path=’.:/usr/share/php’) in /home/vagrant/Code/REDACTED/wp-includes/template-loader.php on line 74

Any ideas please?

Docs have a formatting error on the filter, it’s missing the \\ found below:

add_filter('sage/wrap_base', __NAMESPACE__ . '\\sage_wrap_base_cpts');
1 Like

thanks @ben this helped a lot!