April 23, 2012 at 10:47 pm #11723
This is a tough one…
I need some help to add sliders, images and text content to the top of each of my Woocommerce Category pages. Making matters more complicated, each Woocommerce Category requires different images and text. And making matters even more complicated, I’d like the content that I insert at the top of each Woocommerce Category page to be editable by our webmasters.
The solution that I am imagining is to surgically insert a standard WordPress Page that I have specifically created for each Woocommerce category immediately above the product loop on each corresponding Woocommerce Category page.
Visualize a Woocommerce category called ‘Dresses’ which renders a Woocommerce Category page in my shop called ‘Dresses’. There is also a special WordPress Page called ‘Dresses’ with the slider and text that I want to appear above the Woocommerce product loop. Now visualize the content div from my WordPress ‘Dresses’ page being embedded into the top of the Woocommerce ‘Dresses’ Category page directly above the Woocommerce product loop.
I realize this all sounds very complicated but I have spent a good deal of time inspecting the code and I think I have a good general understanding of how to achieve this.
My game plan is to insert a call to get_template_part( ‘includes/loop’, ‘page’ ); into the function woocommerce_product_taxonomy_content() in woocommerce-template.php. This call would be inserted immediately before the call to woocommerce_get_template_part( ‘loop’, ‘shop’ ); Could you please confirm whether or not this is the correct approach.
Also, if this is the correct approach, how do I make the call to get_template_part( ‘includes/loop’, ‘page’ ); with a specific page ID that is not the page the user is currently viewing? This is critical because, from the WordPress perspective, the user is currently viewing the Woocommerce ‘Dresses’ Category page and not the WordPress ‘Dresses’ page that I am trying to embed. As such, WordPress doesn’t have access to the page ID for the WordPress ‘Dresses’ page that I am trying to embed so I will need to provide that to get_template_part programatically. How do I do this?
I realize that this is some advanced coding here but I appreciate any help you can provide. Thank you.April 24, 2012 at 5:18 pm #72811April 26, 2012 at 3:15 pm #72812
I’ll flag this post for Dude to take a look at this as I think he is the best equipped to give a good opinion on your general direction. I would also suggest (for at least the non theme related part) asking on the WooCommerce forums.
DevinApril 27, 2012 at 6:04 am #72813
To be honest I don’t want to claim “good approach” or “bad approach” without in-depth investigation (otherwise I may be wrong and my advice is misleading and not helpful). However personally I feel that your current approach isn’t the best one, especially because you can’t pass a page id on an archive page (you’d need to find a workaround, like a custom input field on the category archive page). I’d rather try to use standard features like the category description field to display custom html text. Plugins like: http://wordpress.org/extend/plugins/categorytinymce/ can even add a visual editor to the category and tag editor pages.July 30, 2012 at 2:20 am #72814
Thanks Dude. categorytinymce solved the problem pretty well. Would have been nice to include the Propulsion slider at the top of each shop category page but a static image embedded with categorytinymce is almost as good. Thanks for the suggestion.July 30, 2012 at 7:29 am #72815
The topic ‘Customizing Woocommerce Category Pages’ is closed to new replies.