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
Change loop-start.php and loop-end.php with themes function.php #5197
Comments
Looking at the code:
This is pluggable. |
Hi Mike, I asked a plugin developer about this, but he told me it's not possible because there is no hook/filter. So what do you mean with pluggable? |
i know its been 6 weeks, but wc_get_template( 'loop/loop-start.php' ); this is the line that you should be looking at. open this file and you can change the <ul class="products"> |
Hi LC43, no problem, I'm always willing to learn, even 6 weeks later. But I know I can overwrite that template file, but I was thinking maybe there is a way to overwrite it just by using functions.php so I don't have to 'overwrite' template files ;-). But I think the only way it's possible is how you mention it. |
Hi @Willem-Siebe thats a great attitude! you should overwrite them if you need to! just overwrite the templates files that you copied to your theme directory. |
Hi, Function wc_get_template is pluggable itself, look the source code to find the hooks and use them at your functions.php file. Yet the easier way is to add the 'loop/loop-start.php' template to your theme. (Don't forget to make a child theme if your theme is not custom) Another approach is to create your own 'woocommerce_product_loop_start' & 'woocommerce_product_loop_end' functions. Cheers |
Hi all, because it isn't a support forum here I asked greguly some more explenation per e-mail, and luckily he was very helpfull and his answers made me learn some new stuff. Because it might be helpfull to other readers as well I asked him if I could share the more in depth solutions here. So here they are. This is from lines 73-74 of wc-core-functions.php
To learn about filters, check this codex page: http://codex.wordpress.org/Plugin_API Basically you will add a filter like this at your functions.php file:
And then your loop-start.php will have whatever you want, like ' ' for instance. ';
Same for loop-end.php, e.g., '
http://codex.wordpress.org/Pluggable_Functions
Kind regards, Willem |
I don't know whether it's Genesis connect or not but when using: It echos in the wrong place and so the woocommerce_no_products_found(); is now part of the loop content. Which puts the This works in my child theme to create the new loop start in the correct location.
|
Hi,
I have a feature request, that we can change loop-end.php and loop-start.php with our themes fuction.php.
Now it outputs (loop-start.php):
When I want to change to a div for example, I have to overwrite the template file, which I prefer not to do so. If I'm overlooking something and it is possible in fuctions.php, please let me know.
Kind regards,
Willem
The text was updated successfully, but these errors were encountered: