Open kloon opened 9 years ago
Must be possible!
@jameskoster @kloon What if you try do that with template_include? Like this example: http://wordpress.stackexchange.com/questions/51038/template-include-overriding-default-plugin-templates-via-current-theme
I think would be awesome for the plugin to have this filter inlcuded.
+1 on this
It should have a specific folder where we could put the same files we could override with a child theme, like header.php, footer.php etc... It should also have a "woocommerce" sub-folder in order to override WooCommerce's template files, emails, etc...
:+1:
+1
To my knowledge, template partial overrides aren't currently possible :(
So I tried to override a WooCommerce template (cart/cart.php) by placing it in <plugindir>/custom/templates/woocommerce/cart/cart.php
, and it did not work.
So I wasn't sure if the commit by @jameskoster actually implemented that request mentioned by @webdados above...
So I went ahead an implemented a separate route that uses wc_get_template and looks in <plugindir>/custom/woocommerce
.
It can be found here: #11
theme/template overrides?
Please NO!
Why can't changing-a-template-file simply be done with hooks in custom/functions.php
Storefront seems kind of like a fail. I can't believe that WooCommerce didn't provide a way to create custom pages that don't get overriden on theme updates. This is bad dev and planning by Woothemes
It's as much a WordPress thing as a Woo thing. Using a child theme from any theme author will make template overrides tricky because WordPress core doesn't allow a level beyond child themes (grand-child themes). There are plugins to enable this functionality if you need it. Alternatively you can use page builders or create your custom pages using hooks / filters.
needed to know more about this which is on the homepage of this git repository.
"= Should I put all my customisations in this single plugin? = That's entirely up to you. There's nothing to stop you from duplicating this plugin and changing the name. That way you could theoretically keep each of your customisations in their own individual plugins. This can be very handy when debugging, or if you want to quickly enable/disable a specific customisations temporarily."
so how exactly is that done? how do we duplicate it? where do we put it? and what name do we give it? give an example if possible. all i know is that i am trying to put different modifications that go in functions.php (the original one), and trying to put them in the functions.php file inside of theme-customisations, and it doesn't always work. some modifications work and some don't. would like to know how to make more modifications work without editing the original functions.php file.
thanks.
@leoarce depending on when / where the action is supposed to fire, complications can happen.
Just make a blank child theme like this example one: https://github.com/stuartduff/storefront-child-theme For CSS changes use the child theme or the built in CSS in the built into WordPress when you open the customizer. For php and code, use the child theme's functions.php file
so how exactly is that done? how do we duplicate it? where do we put it? and what name do we give it? give an example if possible.
Easiest way to duplicate is to download a fresh copy of the plugin, open up theme-customisations.php
and change the name here.
Upload it to your wp-content/plugins/
directory.
You can name it anything you like. If you're creating a separate plugin per customisation then use something descriptive.
What about theme/template overrides? Perhaps there is a way we can make the plugin modify the order WordPress looks for overrides to first check this plugin folder for the overrides and then proceed with the usual order of checking?