I’ve got a bit of a strange issue with Sage 9/Blade, and I was hoping someone might be able to shed some light on it.
In partials/footer.blade.php I’m trying to include another partial (contact-details.blade.php) in the same directory, but am getting a fatal error.
I’ve noticed in, for example, content-single.blade.php the format for including another partial is
@include('partials/path-to-partial) rather than the dot syntax, and I’ve tried both in my case
Error:
ErrorException: Call to a member function make() on null (View: /Users/dougbelchamber/Workplace/site/wp-content/themes/theme/templates/layouts/base.blade.php) (View: /Users/dougbelchamber/Workplace/site/wp-content/themes/theme/templates/layouts/base.blade.php) in /Users/dougbelchamber/Workplace/site/wp-content/uploads/cache/compiled/bfd3a125bf73746ddbf7c7ba0c4773a0905c7a71.php on line 5
Call Stack
(Discourse looks like it’s going to truncate some of the error, so here’s a PasteBin: http://pastebin.com/uErV8QJU)
While rushing out, one slightly crucial thing I might have neglected to mention (my bad!) is that I am going slightly off-piste with the footer…
In base.blade.php, I have removed the reference to @include('partials.footer') and elsewhere in my theme, as I did in Sage 8, I hook into wp_footer and conditionally show the contents of the footer template part depending on the value of a custom field.
I’ve modified this for Sage 9; previously it was just a get_template_part() call to the footer template part.
So to recap:
Base.php (in my case) doesn’t have @include('partials.footer')
I conditionally call the footer using include \App\template_path( locate_template( 'templates/partials/footer.blade.php' ) ) by hooking into `wp_footer
Calling the footer template part in this way works until I then also call a template part using blade (ie @include) within footer.blade.php
To be able to call a partial from a partial that’s not been called by blade, I can use @php (include \App\template_path( locate_template( 'templates/partials/contact-details.blade.php' ) ) )
Perhaps there’s a way to include the template part when I hook into wp_footer which will allow for @include() to be used… I’ll continue to play with some of the helper functions and report back!