Comments (4)
Hey! We've had somebody else run into this issue once before. It's caused by some inflexibility in the WP core itself, which meant we had to implement the Lumberjack Controller stuff in a particular way. This method relies on the "template_include" filter, which both Lumberjack and WooCommerce both use.
In short, due to some of the complexities in Lumberjack, the WooCommerce's "template_include" filter doesn't run.
We've put in a ticket into the WP core so in the future we can use something other than "template_include": https://core.trac.wordpress.org/ticket/46652
We would like to work out a patch for this, however we have not done anything with WooCommerce ourselves so it would be great to work with someone to get this tested and resolved.
Would you be able to try adding in return $template
at the end of the handleTemplateInclude()
method in Lumberjack's WordPressControllersServiceProvider
class please, and let us know if that resolves the issue?
Here's a link to that method for reference: https://github.com/Rareloop/lumberjack-core/blob/v4.2.0/src/Providers/WordPressControllersServiceProvider.php#L21
from lumberjack.
Hey! Thanks for your quick response.
This is my first contact with Lumberjack, I decided to use it when my patience for the spaghetti code in WP was over. I just have to do a simple shop based on Woo, so I'm hoping for Lumberjack.
Would you be able to try adding in
return $template
at the end of thehandleTemplateInclude()
method in Lumberjack'sWordPressControllersServiceProvider
class please, and let us know if that resolves the issue?
Unfortunately, nothing happened, Lumberjack still reads from archive.php or index.php.
But I found a temporary solution that works - I created a taxonomy-product_cat.php file with a TaxonomyProductCatController class controller and now reads the data correctly.
We would like to work out a patch for this, however we have not done anything with WooCommerce ourselves so it would be great to work with someone to get this tested and resolved.
I am pleased to be able to contribute at least a little to the development of this project by testing it. I hope I won't encounter any more problems and the WP team will fix soon this inflexibility in the WP Core.
I can share my impressions when I finish my shop.
from lumberjack.
@mrkkr Glad you found a work around. Thank you for giving that a test.
We are currently exploring an alternative approach to the way we use template_include
which should resolve this issue.
from lumberjack.
Hi, I think I ran in the same problem with another plugin. The plugin has its own subfolder in the theme with an archive and single template. This caused a problem with converting the template to a controller. I wanted a way to disabled templates to be converted to controllers so that we can use old school Timber::render
or even older the_post
.
First I've created my own WordPressControllersServiceProvider
and replaced the Lumberjack WordPressControllersServiceProvider
in de app.php
:
'providers' => [
Rareloop\Lumberjack\Providers\RouterServiceProvider::class,
// Rareloop\Lumberjack\Providers\WordPressControllersServiceProvider::class,
App\Providers\WordPressControllersServiceProvider::class,
Rareloop\Lumberjack\Providers\TimberServiceProvider::class,
Rareloop\Lumberjack\Providers\ImageSizesServiceProvider::class,
Rareloop\Lumberjack\Providers\CustomPostTypesServiceProvider::class,
Rareloop\Lumberjack\Providers\MenusServiceProvider::class,
Rareloop\Lumberjack\Providers\LogServiceProvider::class,
Rareloop\Lumberjack\Providers\QueryBuilderServiceProvider::class,
Rareloop\Lumberjack\Providers\SessionServiceProvider::class,
Rareloop\Lumberjack\Providers\EncryptionServiceProvider::class,
// Application Providers
App\Providers\AppServiceProvider::class,
],
Then I've create a new config file named controllers.php
with an config array with a key exclude_templates
:
<?php
return [
'exclude_templates' => [
'/subfolder/archive.php',
'/subfolder/single.php',
],
];
This is what's in my own WordPressControllersServiceProvider
:
<?php
namespace App\Providers;
use Rareloop\Lumberjack\Providers\WordPressControllersServiceProvider as LumberjackWordPressControllersServiceProvider;
use Rareloop\Lumberjack\Facades\Config;
use Stringy\Stringy;
class WordPressControllersServiceProvider extends LumberjackWordPressControllersServiceProvider
{
public function handleTemplateInclude($template)
{
if (in_array(Stringy::create($template)->removeLeft(get_template_directory()), Config::get('controllers.exclude_templates'))) {
return $template;
}
parent::handleTemplateInclude($template);
}
}
I think this is an easy way to disabled some templates to be converted to controllers. Hope this helps.
from lumberjack.
Related Issues (20)
- Post Type not registering HOT 6
- Wrong class on the WordPress Controllers documentation? HOT 2
- Undefined Illuminate classes
- Custom Taxonomy support in Lumberjack HOT 5
- Enqueue Assets HOT 2
- Popularity HOT 4
- lumberjack-bedrock permission error while cloning Bedrock repository HOT 3
- Incomplete theme HOT 2
- Request with a dot (".") inside a Custom Route paramter returns a 404 (not found) exception HOT 2
- WooCommerce products in Lumberjack HOT 1
- How can I return a 404 Not Found error from my product controller? HOT 1
- Custom post type translatable labels not working HOT 3
- [bug] site stop working after install wp-browser
- Twig dump error? HOT 4
- QueryBuilder - Collection error after installing Intervention/ImageCache HOT 1
- pass cache time to TimberResponse?
- Access correct pagination information when using the Query Builder HOT 1
- php 8.0.0 not compatible with v4 (composer issue)
- PHP8 Compatibility HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lumberjack.