Sage 9 additional custom templates not found in Wordpress 'Page Attributes'

I started setting up a local dev environment using Roots today. I installed the latest version of Trellis, Bedrock, and Sage 9 and everything seemed to be working fine. Except for one catch.

Usually, to create a new custom page template, I would copy template-custom.blade, rename it to template-[something else].blade, change the template name at the beginning of the document, and Wordpress would pick it up and I could select my new template from the Page Attributes section of the page editor and do what i needed to do and everything was awesome.

However, for some reason, for this install, Wordpress isn’t picking up my additional custom templates. If I change the template name inside template-custom.blade to something like, say, “stinky socks”, Wordpress recognizes the name change and “stinky socks” shows up in the page attributes dropdown. But it won’t pick up any additional templates I create. It will only show the initial two (Default and Custom).

I just set everything up this week, so I have the latest versions of everything. I’ve cleared my cache but that isn’t the problem either. It shouldn’t be a Mac/PC thing, right? Sage 9 works perfectly fine on my Mac at work but i’m not having the same luck on my PC so far… I can’t imagine that would be the issue.

Is anyone else having this problem? I can’t find any solutions to this and it’s driving me nuts :frowning:

The way you describe it, this is similar to a bug introduced in WordPress 4.9 and fixed in 4.9.1.

What version of WordPress is Bedrock pulling in for you? Check composer.json in the site directory.

You could also see if any coaching plugins are enabled and disable them for dev.

I did see a thread somewhere that talked about that fix, but my Wordpress install is 4.9.2 (I just double-checked, just to be sure). And i don’t have any plugins installed either… :frowning:

Have you done anything other than adding the templates to Sage? Can you try a fresh copy of Sage where the only thing you change is adding a template?

Making the templates was basically the first thing i tried to do. When that didn’t work I did try to create a whole new environment in a separate folder, downloading trellis and bedrock again and installing sage 9 and all that. When that was booted up, first thing I did was create a custom template and go to page editor in wordpress, but it still didn’t show up. So this issue seems to occur in any Roots 9 site I create.

I will note that the latest version of Sage 8 (8.5.3) seems to work fine. I initially had that installed, but wanted to use browsersync, blade, and other features that came with Sage 9, so I switched. I didn’t catch what Wordpress version was installed when I was running Sage 8 though…

Have you run yarn and yarn build yet? I’m not positive but I think Blade needs to build its cache before things will work right?

I’m grasping at straws, though.

Just gave it a try, but no luck :pensive:

I installed Sage 8.5.3 again on the same wordpress install and switched to it, and custom templates are being found. So I think this might actually be a Sage 9 problem, and not a Wordpress problem.

Previously this was a big issue for me because I could not get browsersync to work on my Sage 8 install, so I thought I had to use Sage 9. But I just figured out how to get browsersync working on my Sage 8 install so it’s not really a huge deal anymore. Though I am curious if anyone else has been having the same issue.

Oh! looks like I solved the issue actually.

I use Sublime Text 3 as my text editor. When I copy documents I press ctrl + shift + s, rename the file, and save it. I didn’t pay close attention though and it turns out that when I was saving these custom files, they were being saved as [name].blade and not [name].blade.php. I feel like such a doofus. I changed the extention to .blade.php on one of the files and it shows up in Wordpress now.