Hey guys,
I've just installed the latest versions of the plugins released today and it looks like the new functionality you added to Layouts for deciding what shows by default on the site is conflicting with the Sage theme from hidden link
That theme uses a wrapper for the WordPress template hierarchy that injects one file at the top of the loaded template array called base.php, which contains the overall layout markup for the site removing the need to call functions to load page elements on all templates.
The solution is quite clean and elegant and I haven't had any issues with it yet.
More details here: hidden link
By the look of it, when there are no Layouts specified and the Layouts plugin is set to display "What the theme would output" it somehow breaks or bypasses the wrapper code (hidden link). I only see the markup from the standard WP templates and not the wrapper that should have been added.
I created a simple "default" template and assigned it using the "The content using a following 'default' Layout" option in Layouts and again, I'm not seeing the wrapper markup.
So, one interesting thing is that setting "A blank page with a message" I get a page that does actually load the base.php markup through the wrapper but errors out with a warning about a missing header.php (which is usually not a problem as it's implemented in Sage programmatically). If I add the missing header.php and later footer.php and refresh, I don't get any further errors, but the base.php no longer loads through the wrapper. This makes me think that Layouts is affecting the template heirarchy array and is resetting the changes that Sage's wrapper script injects there.
Disabling layouts fixes this and the site displays all the markup correctly, including that from base.php.
All in all, whatever code you guys are running for this functionality, it seems to be breaking, or resetting the changes done by Sage to the template hierarchy.
Please get in touch in private if you'd like access to this tester site.
Regards,
Andy
Hello,
I’m Adriano, Toolset support lead and I have been escalated to this thread. I’ll give my best to help you to achieve your needs through Toolset components.
I need to request temporary access (wp-admin and FTP) to your site in order to be offering better help. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.
All right, could you just zip the Sage theme and send it to me? I think it will be enough to do some tests.
You can get the Sage theme from their repo: hidden link
Although, I had a bit of time to spare today and I found the problem for you...
If you look at hidden link, this code adds the base.php to the template hierarchy using the template_include filter at priority 109 (line 64).
By the look of it, the new version of Layouts does something with this filter at a higher priority than 109 and breaks removes the wrapper.
Testing Sage with a a higher priority in this filter fixes the problem.
So, seeing as Sage is an established code-base used by a lot of devs, I'd propose that you should find the relevant filter on your end and drop its priority below 109.
Please let me know what you decide to do, and what the timeline will be for it to be in production versions of Layouts so I can plan upgrades/patches to my projects accordingly.
Regards,
Andy
Can i have the patch or fix information for this as I'm using the original roots theme (pre sage) and layouts has broken that too
Thank you for debugging that, it helps a lot. I've forwarded all the information to our development team. I'll get back to you as soon as I hear something back.
We've fixed that and it will be addressed in the next release. If you want to try implement this fix, you just need to open the file: /layouts/classes/wpddl.layouts-templates-settings.class.php
Then replace:
add_filter( 'template_include', array( $this, 'template_include' ), 999, 1 );
With:
add_filter( 'template_include', array( $this, 'template_include' ), 108, 1 );
Please let me know if you are satisfied with my reply and any other questions you may have.
Regards,
Adriano Ferreira
Adriano,
Thanks for that. I did a bit more research for you and found that the older version of the Sage theme (used to go by the name Roots), uses the wrapper at priority 99.
If it's all the same to you guys, then I'd propose using priority 98 in your patch.
Thanks again and regards,
Andy
Awesome, I'll suggest that to our development team. Is there anything else I can help you with?
Nope... That's all. Just wanted to make sure you saw that last message. 🙂
Thanks for the help. A pleasure as always.