Before you ask please READ THIS

change banner and number of columns

edited February 2015 in Fame Posts: 3
My client would like to change the banner on my shop page so it differs from the product page. Is there an easy way to accomplish this? My client would also like to change the number of columns on the shop page to 2 column from the default 4 columns. I realize that this is a default WooCommerce issue but would you have any ideas?

I tried adding this code to the functions.php file but that didn't fix the column issue:
------------------------------------

add_filter('loop_shop_columns', 'custom_loop_columns');
if (!function_exists('custom_loop_columns')) {
function custom_loop_columns() {
return 2;
}
}
------------------------------------

I've also tried:
------------------------------------
add_action ('init', 'change_columns');
function change_columns() {
add_filter( 'loop_shop_columns', 'custom_loop_columns' );

function custom_loop_columns() {
return 2;
}
}
------------------------------------
In addition to this in my CSS:
------------------------------------
ul.products li.product { clear: none; width: 50%; }
------------------------------------

Any ideas?


Thanks Apollo!

Comments

  • AirAir
    Posts: 10,970
    Hello there :-)

    Your PHP code works fine(gives two columns), but CSS is to weak and you will not see good size of products. Do you use sidebar in your shop page ? If yes then try this custom CSS:
    .woocommerce-page .left-sidebar ul.products li.product, .woocommerce-page .right-sidebar ul.products li.product{
    width: 47.8%;
    }
    You can adjust this, remembering that there also have to be space for margin, that is why I am not adding 50% :-)
    pwmulder said: My client would like to change the banner on my shop page so it differs from the product page
    Banner? Could you show on screen shot and maybe link what you mean by this? Maybe you don't mean real shop page but standard page with woocommerce shortcodes inside?

    With kind regards.
  • Thanks for the effort Apollo but that didn't seem to work. I've toyed with the code on my end and tried other ideas without success. Let me know if you would like me to toss you the link and you can see for yourself. As for the banner, I changed my client's view on whether she needed a different banner on every page so we're good there. But I still need to make this a 2-column layout and not 4. My client was very adamant about that. I will try to reason with my client again but do you have any other ideas for the 2-column layout?
  • AirAir
    Posts: 10,970
    Yes show me link, cause you didn't answered is it main shop page or just static page with woocommerce shortcodes. Paste link to that direct page. I will find answer my self:-)

    If you don't want this link to be visible for public then send me it in private message (click on my nick and there you will find option "Send Air a Message").

    With kind regards.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!