Not greatly familiar with how to use hooks, could anyone shed some light on how to achieve this?
Have read the documentation @ woocommerce & wordpress and am still struggling...
Not greatly familiar with how to use hooks, could anyone shed some light on how to achieve this?
Have read the documentation @ woocommerce & wordpress and am still struggling...
if you don't know hooks, override the templates themselves.
There are instructions here:
http://wcdocs.woothemes.com/codex/template-structure/
Get the content with something like
echo apply_filters('the_content', $post->post_content );
Thanks Mike.
I had initially overridden the template file, utilising the products loop outlined in your documentation here - http://wcdocs.woothemes.com/snippets/sample-products-loop/
I was using that loop to display products on my catalog page, which worked mostly fine, except for the fact that it made the woocommerce layered nav widget I have on the catalog (to sort products) no longer work.
I would prefer to override the theme files this way, as it's a technique I'm more comfortable with, but we do need to be able to sort products on the catalog using the layered nav widget. Is there something I need to add to that product loop in order to allow the widget to work? This is primarily the reason I went back to attempting to achieve this using hooks.
Oh and also just as an aside, I did initially mimic the file structure (as is outlined in the link you provided above) of the plugin within a woocommerce folder in my (custom made) theme, and no changes applied when I attempted to override the file. So I've just dumped the relevant woocommerce files I need to override directly into the top level directory of my theme folder, which appears to work a treat.
Anyway, any assistance on the layered nav widget issue above would be appreciated heaps.
Cheers dude.
You may have been mirroring the structure wrong. Check you were not use woocommerce/templates/ - it should be just woocommerce/ in your theme folder.
Layered nav is unaffected by template changes, although if you do anything to modify the wp query that could break things.
I was mirroring the template structure incorrectly, your recommendation above resolved that issue. Cheers.
I've also gone back to overriding the template file completely by simply utilising a straight up loop (rather than hooks) on the archive-product.php file, for the catalog.
Heeding your advice above re layered nav being broken by modifications to wp query, I removed the entire call to wp query included in your supplied sample products loop and wrapped my loop with the usual loop call I use - <?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>
Layered nav now functions as it should, which is great. I'm not entirely confident that I am achieving in the best way though... I was always under the understanding that custom posts (of which woocommerce products are yeah??) required a customised version of wp query to function correctly. Though the catalog page is simply echoing out data from these custom posts, so maybe the method I have used is ok?
The queries are all setup by woocommerce - you don't need to touch them.
You must log in to post.