Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template overrides? #1

Open
kloon opened this issue Mar 6, 2015 · 13 comments
Open

Template overrides? #1

kloon opened this issue Mar 6, 2015 · 13 comments
Assignees

Comments

@kloon
Copy link
Member

kloon commented Mar 6, 2015

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?

@jameskoster
Copy link
Member

Must be possible!

jameskoster pushed a commit that referenced this issue Jun 30, 2015
Fixing capitalisation :)
@RubenMartins
Copy link

@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.

@webdados
Copy link

webdados commented Aug 5, 2015

+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...

jameskoster added a commit that referenced this issue Oct 24, 2015
Filters `template_include`. Gets the requested template, checks if that
file exists in the plugin and loads it.
@montalvomiguelo
Copy link

👍

1 similar comment
@kish2011
Copy link

+1

@jameskoster
Copy link
Member

To my knowledge, template partial overrides aren't currently possible :(

@bbatchelder
Copy link
Contributor

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

@BurlesonBrad
Copy link
Contributor

theme/template overrides?

Please NO!

Why can't changing-a-template-file simply be done with hooks in custom/functions.php

@Connect4Brian
Copy link

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

@jameskoster
Copy link
Member

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.

@leoarce
Copy link

leoarce commented Nov 7, 2017

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.

@BurlesonBrad
Copy link
Contributor

BurlesonBrad commented Nov 7, 2017

@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

@jameskoster
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants