I'm working with WooCommerce including the WooCommerzce Germanized Plugin.
The Plugin changes a lot of WooCommerce to make it safe for usage in Germany.
Now I need to modify a template file of the plugin. Whats the best way to make the changes? I don't want to modify the template itself to keep it safe for updates.
In order to override any WooCommerce plugin template you should create a folder in your active theme named after the plugin you are going to modify. Then follow the template folders structure ignoring just the folder templates and copy the desired file there.
For example, I needed to modify the WooCommerce Germanized Pro template based in /plugins/woocommerce-germanized-pro/templates/checkout/multistep/data.php. To modify it I have copied it to my theme: /themename/woocommerce-germanized-pro/checkout/multistep/data.php -- this way it will override an original template file.
Good luck!
Related
I am developing a custom theme from scratch in WordPress, So i have few questions about it.
1) Is custom theme create using default theme.
For example ( Suppose i have copied twentyseventeen and paste it and rename it my_custom_theme then after changes as per HTML in particular files (header,footer etc)
2) Should i create necessary files for theme like (header, footer, index, style, page, function etc)
So i want to clarify which way should i go for create a custom theme 1st or 2nd.
Someone please help me for this
I would recommend using underscores
It is a starter theme foundation setup built for that purpose, it has all the needed files templates and uses the best practices and organised code.
You will take it and build your theme from it.
There is also understrap which is underscores with bootstrap styling
this will save you alot of setup and preparation time, you can delete and remove any code or any template you not using.
I am using Woocommerce Projects plugin for WooCommerce and I have made some extra meta fields for the Projects.
But how can I display them on the place where I want them?
On this example page they show an option that will show it under the short description. But how can I change the location, to put it everywhere I want in the template file.
Update (see below: Overriding Projects template files safely)
What you are looking at, is this documentation, that lists all possible hooks with WooCommerce "Projects" plugin.
So you will have just change the hook in:
add_action( 'projects_after_loop_item', 'display_new_projects_fields', 10 );
Replacing 'projects_after_loop_item' by one of the hooks below to change the displayed location around the loop (for example):
projects_before_loop
projects_before_loop_item
projects_loop_item
projects_after_loop_item
projects_after_loop
Or also (with the other "Projects" plugin templates):
## General layout
projects_before_main_content
projects_after_main_content
projects_sidebar
## Archives
projects_archive_description
## Single Projects
projects_before_single_project
projects_before_single_project_summary
projects_single_project_summary
projects_after_single_project_summary
projects_after_single_project
Overriding Projects template files safely
Copy the templates directory located in projects-by-woothemes plugin folder to your active child theme directory (or active theme directory) and rename it projects.
Projects plugin will always check your theme for these files before displaying core templates as a fallback. Any template files found in the theme will be given priority and the core counterpart ignored.
Now you can edit any template file as you want, adding inside it this little peace of code (from the example), directly just where you want, displaying your custom field value, just using:
echo esc_attr( get_post_meta( $post->ID, '_location', true ) );
At the end, is better to keep in that folder, only the customized templates.
Reference and related:
Editing Projects Templates Safely
Overriding Templates via a Theme
I'm using the 3.9.3 version of Avada and the 2.5.5 version of WooCommerce.
How can I edit the fields that are in the checkout page?
I want to auto compile the email field with a saved cookie and make the email input readonly.
Is it possible? What files I need to edit?
Thanks.
You can do that in woocommerce templates (and also with some hooks).
For templates files, they are located in your woocommerce folder. You have to copy this templates directory inside your active theme (or child theme) and rename it woocommerce (if don't exist yet).
Inside the new directory woocommerce located in your active theme, go to checkout subfolder and you will find related php files, that you can edit to fit your needs.
After that if you need a specific hook, you can search in here (or post a related question, if it doesn't exist yet). Here you can fin an example of hook…
I just setup WooCommerce on my wordpress site:
http://artendijen.com/product/test-product/
I am not a fan of the template where it has the description and additional information below and in tabs, I would like the have the description and additional information to the right of the product image. Is there a setting I missed or will I have to edit it via CSS myself?
There is no setting for layout in WooCommerce. If you can do what you need to do with CSS then thats great. Otherwise, you will need to use hooks and actions in your functions.php to move things around. You can also overwrite woocommerce template files by copying them to your template with the same structure and file names you find in the WooCommerce plugin.
http://docs.woothemes.com/document/introduction-to-hooks-actions-and-filters/
I have a created a view (lets call it my_view).
In the theme: information section if the view I have noted one of the suggested template names (views-view--my-view--default.tpl.php (or close to that)), and created my own template file with that name.
This all works fine and when I visit the theme registry, I can see there is a hook there with the name of the template (views-view--my-view--default). However this hook has a type field of 'engine' rather than 'module'. I assume this is to do view the way views works out its own theming?
I want to implement hook_registry_alter to modify this theme hook (and others created in the same way), but I cant work out how to retrieve a list of these hooks.
I tried using array_keys(views_theme()) to get all the views hooks back but this list doesn't contain hooks created by over-riding template files. It only contains the default hooks like views_views_field etc
Is there a way to bring back a list of views theme hooks over-ridden in this way?
I answer here as your last comment seems to indicate you are not interested anymore in pursuing your initial approach, and 600 chars would not be enough, anyhow.
An alternative approach to achieve what you want could be to use the "inheritance" of sub-themes from their parent theme. You could in other words define your user theme as a sub-theme of the admin theme.
In this way the theming engine would search for templates - in the case of a user viewing the site through the user theme - first in the user theme folder, then in the admin theme folder, and then in the module directory.
This is for example the same mechanism used by zen for letting you create your themes with the starter kit.
Hope this helps!