How to call blade template from MU plugin

Hi there,

Looking for a bit of guidance!

In the past when using sage pre v10 I’d often need to use get_template_part from a custom functions plugin in the mu-plugins directory. I often do this with woocommerce projects when I want to use hooks on the single-product template.

How would I go about doing this in sage 10? I know I can create partials with plain php files in this situation, however I then lose the ability to use directives like @asset to load images etc.

Just curious how others handle this issue and if there are any helpful guides out there

You can create a mu-plugin based on the Acorn example package.

You will need to modify your main composer.json file (I’m assuming you’re using bedrock as well)

  • Add "VendorName\\ExamplePackage\\": "web/app/mu-plugins/your-muplugin-name/src" to autoload.psr-4.
  • Add VendorName\ExamplePackage\Providers\ExampleServiceProvider to extra.acorn.providers.
1 Like

This is great. Many thanks tombro!