I’m working on a Sage project that is using testimonials in a widget sidebar position and displaying on multiple pages in the main content through shortcodes.
I was hoping to be able to easily display all the widgets on one Testimonials page in the main content without having to just list all the shortcodes.
I was thinking I could create a template.php file and then create a copy of the base.php to base-testimonials.php and swap out the main content php with <?php dynamic_sidebar('sidebar-testimonials'); ?>
Doesn’t seem to work though and I’m also not sure if this would be the recommended way to do this even if it was working.
That could work but isn’t exactly how I would do it…
I’d probably make a partial templates/testimonials.php and then put dynamic_sidebar('sidebar-testimonials'); in there.
Then I’d make a new page called page-testimonials.php and then I’d put get_template part('templates/testimonials'); there instead of the call to the content-page.php partial like so:
Boom. Now your base.php hasn’t been edited and you have everything split up all nice. Plus you can use the testimonials sidebar in other places now because it’s a partial!