Hi! I want to use woo commerce in my theme "good earth" from good layers theme.
All seems to work, but there is a comon problem. The sidebar dissapears on the shop base page.
It seems there is a workaround, but I dont know how to implement this in my code (actually I dont know which ids to change etc.).
Can anyone help me out?
this is my shop page where the sidebar disappear:
http://wp.klausdyba.com/productsss/
Here is the possible workaround (i prefer the 2nd method - using hooks):
http://wcdocs.woothemes.com/codex/third-party-custom-theme-compatibility/
Arnav Joy answers:
have you checked the page template ?
it should allow the sidebar to be display , means you should not choose full width template for this page.
klaus dyba comments:
Yeah it shows thew sidebar, but then I just can use shortcodes which i will avoid. I have to choose a certain page (in my case productsss) as a shop base page in the woo commerce settings. As soon as I do this, the sidebar disappears... I found a solution which might work. See below:
I just dont know how to addapt this to my theme ( that the markup matches my theme)
Using hooks
The hook method is more involved that using woocommerce_content, but is more flexible. This is similar to the method we use when creating our themes. It’s also the method we use to integrate nicely with Twenty Ten and Eleven.
By inserting a few lines in your theme’s functions.php file, First unhook the WooCommerce wrappers;
1
2
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
Then hook in your own functions to display the wrappers your theme requires;
1
2
3
4
5
6
7
8
9
10
add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10);
function my_theme_wrapper_start() {
echo '<section id="main">';
}
function my_theme_wrapper_end() {
echo '</section>';
}
Make sure that the markup matches that of your theme. If you’re unsure of which classes or ID’s to use take a look at your theme’s page.php for a guide.
Arnav Joy comments:
try this in your functions.php
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10);
function my_theme_wrapper_start() {
echo '<div id="container">';
}
function my_theme_wrapper_end() {
echo '</div>';
}
Dbranes answers:
Maybe you could create a new page with right sidebar and use a shortcode
to display the cart, fx: [woocommerce_cart]
More on Woocommerce shortcodes here:
http://wcdocs.woothemes.com/user-guide/misc/shortcodes/
klaus dyba comments:
Yeah I know, but only I can add ID's, so if I add products, I have to change the short code... i want to avoid that...
Dbranes comments:
<blockquote>if I add products, I have to change the short code
</blockquote>
you shouldn't need to do that for the main product page using the above shortcode,
only if you are using a shortcode to display a special product, like [product id="99"] or [products ids="1, 2, 3, 4, 5"]
ps: I can see that you have the sidebar up now, so it looks good ;-)
Francisco Javier Carazo Gil answers:
Hi,
Look at this article: http://rockinwp.com/wordpress-tutorials/woocommerce-thesis-theme-complete-solution/ I wrote it with Rene Sejling and you will find a solution here.